Re: Temporary table - Mailing list pgsql-performance

From Tom Lane
Subject Re: Temporary table
Date
Msg-id 29399.1151100268@sss.pgh.pa.us
Whole thread Raw
In response to Temporary table  ("Franklin Haut" <franklin.haut@gmail.com>)
List pgsql-performance
"Franklin Haut" <franklin.haut@gmail.com> writes:
> How to reproduce :

>     CREATE TEMP TABLE cademp (
>            codemp INTEGER,
>            codfil INTEGER,
>            nomemp varchar(50)
>     ) ON COMMIT DROP;

>     INSERT INTO cademp (codemp, codfil, nomemp) values (1,1,'TESTE');
>     INSERT INTO cademp (codemp, codfil, nomemp) values (1,2,'TESTE1');

>     Select * from cademp;

You need a BEGIN/COMMIT around that, or else rethink using ON COMMIT DROP.
As is, the temp table goes away instantly when the CREATE commits.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Franklin Haut"
Date:
Subject: Temporary table
Next
From: "Larry Rosenman"
Date:
Subject: Re: Temporary table