Re: MySQL-style "create temporary table foo select ..." - Mailing list pgsql-sql

From Michael Kleiser
Subject Re: MySQL-style "create temporary table foo select ..."
Date
Msg-id 40FE86C2.8080903@webde-ag.de
Whole thread Raw
In response to MySQL-style "create temporary table foo select ..."  (Geoff Richards <geoffr@gbdirect.co.uk>)
Responses Re: MySQL-style "create temporary table foo select ..."
List pgsql-sql
create temporary table tmp_foo AS select * from foo;

Geoff Richards schrieb:
> Hi,
> 
> I've got some code that currently uses MySQL, and it copies an existing
> table into a temporary one like so:
> 
>    create temporary table tmp_foo select * from foo;
> 
> That creates 'tmp_foo' with the same columns as 'foo', which is
> very convenient.  I can't seem to find any reference to how to do
> that with Postgres (and I'd like if possible to ditch MySQL).
> 
> Just wondering if anyone has ideas about how to do this?  I'd like
> to avoid having to work up a table definition to define the temp
> table's columns.
> 
> Or maybe I could do some sort of trick with the system catalog tables
> to get the column information in a convenient form?
> 
>    cheers,
>       geoff
> 



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: immutable function calling stable function
Next
From: "Javier Tesis Tolosa Trabajo"
Date:
Subject: Sorry too many conecctions