pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Larry Rosenman <ler@lerctr.org>
To: 'Franklin Haut' <franklin.haut@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Temporary table
Date: Fri, 23 Jun 2006 17:08:05 -0500
Message-ID: <039001c69711$81058a60$0202fea9@aus.pervasive.com> (raw)
In-Reply-To: <000001c69710$264fe940$8adb02c9@franklin>

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@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893




view thread (17+ messages)

Message-ID: <039001c69711$81058a60$0202fea9@aus.pervasive.com>
Permalink:  ../039001c69711$81058a60$0202fea9@aus.pervasive.com/
Also on:    postgresql.org/message-id/039001c69711$81058a60$0202fea9@aus.pervasive.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: ler@lerctr.org, franklin.haut@gmail.com
  Subject: Re: Temporary table
  In-Reply-To: <039001c69711$81058a60$0202fea9@aus.pervasive.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox