Re: Temporary table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Franklin Haut" <franklin(dot)haut(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Temporary table
Date: 2006-06-23 22:04:28
Message-ID: 29399.1151100268@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Franklin Haut" <franklin(dot)haut(at)gmail(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Larry Rosenman 2006-06-23 22:08:05 Re: Temporary table
Previous Message Franklin Haut 2006-06-23 21:58:22 Temporary table