CREATE TEMP TABLE .... ON COMMIT - Mailing list pgsql-hackers

From Gavin Sherry
Subject CREATE TEMP TABLE .... ON COMMIT
Date
Msg-id Pine.LNX.4.21.0208091918180.21494-102000@linuxworld.com.au
Whole thread Raw
Responses Re: [PATCHES] CREATE TEMP TABLE .... ON COMMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Attached is a revised version of my previous

ON COMMIT DROP

patch. This patch implements:

ON COMMIT { DROP | PRESERVE ROWS | DELETE ROWS }

The latter two are SQL99.

Sample usage:
---
template1=# begin;
BEGIN
template1=# create temp table a (a int) on commit drop;
CREATE
template1=# create temp table b (a int) on commit preserve rows;
CREATE
template1=# create temp table c (a int) on commit delete rows;
CREATE
template1=# insert into a values(1);
INSERT 24793 1
template1=# insert into b values(1);
INSERT 24794 1
template1=# insert into c values(1);
INSERT 24795 1
template1=# commit;
COMMIT
template1=# select * from a;
ERROR:  Relation "a" does not exist
template1=# select * from b;
 a
---
 1
(1 row)

template1=# select * from c;
 a
---
(0 rows)

template1=# create temp table a (a int) on commit drop;
ERROR:  You must be inside a transaction to use ON COMMIT

---

Gavin

pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: Re: Locale number format confusion
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: [GENERAL] Linux Largefile Support In Postgresql RPMS