Re: Temporary table

From: "Larry Rosenman" <ler(at)lerctr(dot)org>
To: "'Franklin Haut'" <franklin(dot)haut(at)gmail(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Temporary table
Date: 2006-06-23 22:08:05
Message-ID: 039001c69711$81058a60$0202fea9@aus.pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Franklin Haut wrote:
> Hello,
>
> I´m have some problems with a temporary table, i need create a table,
> insert some values, make a select and at end of transaction the table
> must droped, but after i created a table there not more exist, is
> this normal ?
>
> 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;
>
>
>
> In this case, the table cademp doesn´t exist at the first insert, in
> the same transaction.
>

It is NOT the same transaction. By default, each STATEMENT is it's own
transaction.

Stick a BEGIN; before the create table, and a commit; after the select.

Larry Rosenman
>
>
>
> Tks,
>
> Franklin
>
>
> ---------------------------(end of
> broadcast)--------------------------- TIP 6: explain analyze is your
> friend

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 512-248-2683 E-Mail: ler(at)lerctr(dot)org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Franklin Haut 2006-06-24 00:27:40 RES: Temporary table
Previous Message Tom Lane 2006-06-23 22:04:28 Re: Temporary table