Help with select into

From: Brent Wood <b(dot)wood(at)niwa(dot)co(dot)nz>
To: postgres-general <pgsql-general(at)postgresql(dot)org>
Subject: Help with select into
Date: 2003-03-04 00:35:21
Message-ID: 20030304132624.O88690-100000@storm.niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The following SQL is a simple join of two tables used to create a view
with an integer depth value & explicit centroid assigned to each cell.
(Cells are box datatype)

This works fine.

SELECT chat_cells.cell_id,
chat_cells.cell,
(@@ chat_cells.cell) AS centre,
int4(id_depth.depth) AS depth,
chat_cells.substrate
FROM chat_cells,
id_depth
WHERE (chat_cells.cell_id = id_depth.depth_id);

What I want to do now is save the data as a table, using select into.

The modified query (as I read the docs) should be:

SELECT chat_cells.cell_id,
chat_cells.cell,
(@@ chat_cells.cell) AS centre,
int4(id_depth.depth) AS depth,
chat_cells.substrate
INTO table1
FROM chat_cells,
id_depth
WHERE (chat_cells.cell_id = id_depth.depth_id);

When I run this, I get the error message:

PostgreSQL Error Message:
ERROR: DECLARE CURSOR must not specify INTO

Can anyone tell me what I'm doing wrong & how to select the data into a
new table?

Thanks,

Brent Wood

In response to

  • Re: wal-debug at 2003-03-04 00:00:36 from Martijn van Oosterhout

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-03-04 01:43:00 Re: almost there on a design
Previous Message Dennis Gearon 2003-03-04 00:33:11 Re: almost there on a design