Re: store multiple rows with the SELECT INTO statement - Mailing list pgsql-general

From Kevin Grittner
Subject Re: store multiple rows with the SELECT INTO statement
Date
Msg-id 1378242446.61431.YahooMailNeo@web162903.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: store multiple rows with the SELECT INTO statement  ("Janek Sendrowski" <janek12@web.de>)
List pgsql-general
Janek Sendrowski <janek12@web.de> wrote:

> I just can't understabd why it's not possible to store multiple
> columns returning from a dynamic Select statement which is
> executet with EXECUTE into a temporary table.

You can:

CREATE TEMPORARY TABLE AS SELECT ...

http://www.postgresql.org/docs/current/interactive/sql-createtableas. html

As the Notes section says:

| This command is functionally similar to SELECT INTO, but it is
| preferred since it is less likely to be confused with other uses
| of the SELECT INTO syntax. Furthermore, CREATE TABLE AS offers a
| superset of the functionality offered by SELECT INTO.

Also see this:

http://www.postgresql.org/docs/current/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT

| Tip: Note that this interpretation of SELECT with INTO is quite
| different from PostgreSQL's regular SELECT INTO command, wherein
| the INTO target is a newly created table. If you want to create a
| table from a SELECT result inside a PL/pgSQL function, use the
| syntax CREATE TABLE ... AS SELECT.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-general by date:

Previous
From: Martin Renters
Date:
Subject: uuids with btree_gist
Next
From: David Johnston
Date:
Subject: Re: ALTER TABLE transaction isolation problem