Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP - Mailing list pgsql-general

From Colin Wetherbee
Subject Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP
Date
Msg-id 47D9A921.40500@denterprises.org
Whole thread Raw
In response to Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP
List pgsql-general
Tom Lane wrote:
> Colin Wetherbee <cww@denterprises.org> writes:
>> Adrian Klaver wrote:
>>> Try CREATE TEMP TABLE foo ON COMMIT DROP AS (SELECT 1 AS a, 2 AS b) ;
>
>> I don't know what version the OP is using, but that doesn't work on 8.1:
>
> Seems to be there in 8.2 and up.

In 8.2:

cww=# BEGIN;
BEGIN
cww=# CREATE TEMP TABLE foo ON COMMIT DROP AS (SELECT 1 AS a, 2 AS b);
SELECT
cww=# COMMIT;
COMMIT
cww=# \d foo
Did not find any relation named "foo".

Handy!

Colin

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP
Next
From: Colin Wetherbee
Date:
Subject: Re: Is there a way to elegantly do a : CREATE TEMP TABLE X AS SELECT .... ON COMMIT DROP