Help with select into - Mailing list pgsql-general

From Brent Wood
Subject Help with select into
Date
Msg-id 20030304132624.O88690-100000@storm.niwa.co.nz
Whole thread Raw
In response to Re: wal-debug  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Help with select into
List 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


pgsql-general by date:

Previous
From: cprice@hrdenterprises.com (Chris)
Date:
Subject: LIMIT and SUBQUERIES
Next
From: "oubahssilahcen@voila.fr"
Date:
Subject: Demande d'information