Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT

Lists: pgsql-hackerspgsql-patches
From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-09 09:22:52
Message-ID: Pine.LNX.4.21.0208091918180.21494-102000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

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

Attachment Content-Type Size
temprel6.diff.gz application/x-gzip 4.3 KB
temprel-doc.diff.gz application/x-gzip 1002 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-09 14:33:22
Message-ID: 787.1028903602@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> template1=# create temp table a (a int) on commit drop;
> ERROR: You must be inside a transaction to use ON COMMIT

Surely that's only for ON COMMIT DROP, if you intend to offer the
others?

regards, tom lane


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-09 23:17:36
Message-ID: Pine.LNX.4.21.0208100902100.10901-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Fri, 9 Aug 2002, Tom Lane wrote:

> Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > template1=# create temp table a (a int) on commit drop;
> > ERROR: You must be inside a transaction to use ON COMMIT
>
> Surely that's only for ON COMMIT DROP, if you intend to offer the
> others?

I should have provided details of this in the email. SQL99 details the
baviour as follows:

If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
DELETE ROWS is implicit

This might give users a bit of a surprise so the effective behaviour is ON
COMMIT PRESERVE ROWS.

As for your question (and, perhaps, SQL99) I don't seen how it makes any
sense to specify ON COMMIT outside of a transaction block.

>
> regards, tom lane
>

Gavin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-10 05:16:20
Message-ID: 21071.1028956580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> As for your question (and, perhaps, SQL99) I don't seen how it makes any
> sense to specify ON COMMIT outside of a transaction block.

Surely it does.

CREATE TEMP TABLE foo(...) ON COMMIT DELETE ROWS;

BEGIN;
insert some rows in foo;
process rows in foo;
COMMIT; -- foo is now empty again

BEGIN;
insert some rows in foo;
process rows in foo;
COMMIT; -- foo is now empty again

repeat until application quit...

What am I missing?

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-14 05:23:30
Message-ID: 200208140523.g7E5NUe01345@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Gavin, was this addressed?

---------------------------------------------------------------------------

Tom Lane wrote:
> Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > As for your question (and, perhaps, SQL99) I don't seen how it makes any
> > sense to specify ON COMMIT outside of a transaction block.
>
> Surely it does.
>
> CREATE TEMP TABLE foo(...) ON COMMIT DELETE ROWS;
>
> BEGIN;
> insert some rows in foo;
> process rows in foo;
> COMMIT; -- foo is now empty again
>
> BEGIN;
> insert some rows in foo;
> process rows in foo;
> COMMIT; -- foo is now empty again
>
> repeat until application quit...
>
> What am I missing?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-14 05:35:19
Message-ID: 200208140535.g7E5ZJ902052@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry wrote:
> Bruce,
>
> I intend on addressing this by completely rewriting the patch. When I
> spoke to Tom and yourself about merging it with 7.3 at OSCON I argued that
> storing the ON COMMIT data in a global linked list was better (strictly
> for performance reasons). Given that I've incorrectly implemented DELETE
> ROWS, I think I'll bite the bullet and store the ON COMMIT data in the
> system catalogues per SQL99. Thoughts?
>
> As for when the patch will arrive: as I said in a previous email, I am
> quite busy at the moment. I would like to get this into 7.3, along with
> all the other patches or features I've put my hand up for. What will be
> the effective cut off for patches of this nature given 7.3 beta at the end
> of the month.

The cutoff will be the start of beta, which should be September 1. I am
workikng through my email backlog, and my next step tomorrow is to focus
on the open issues to decide how or if they will be done for 7.3 so we
can focus our energy.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-14 05:35:47
Message-ID: Pine.LNX.4.21.0208141528430.7611-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce,

I intend on addressing this by completely rewriting the patch. When I
spoke to Tom and yourself about merging it with 7.3 at OSCON I argued that
storing the ON COMMIT data in a global linked list was better (strictly
for performance reasons). Given that I've incorrectly implemented DELETE
ROWS, I think I'll bite the bullet and store the ON COMMIT data in the
system catalogues per SQL99. Thoughts?

As for when the patch will arrive: as I said in a previous email, I am
quite busy at the moment. I would like to get this into 7.3, along with
all the other patches or features I've put my hand up for. What will be
the effective cut off for patches of this nature given 7.3 beta at the end
of the month.

Gavin

On Wed, 14 Aug 2002, Bruce Momjian wrote:

>
> Gavin, was this addressed?
>
> ---------------------------------------------------------------------------
>
> Tom Lane wrote:
> > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > As for your question (and, perhaps, SQL99) I don't seen how it makes any
> > > sense to specify ON COMMIT outside of a transaction block.
> >
> > Surely it does.
> >
> > CREATE TEMP TABLE foo(...) ON COMMIT DELETE ROWS;
> >
> > BEGIN;
> > insert some rows in foo;
> > process rows in foo;
> > COMMIT; -- foo is now empty again
> >
> > BEGIN;
> > insert some rows in foo;
> > process rows in foo;
> > COMMIT; -- foo is now empty again
> >
> > repeat until application quit...
> >
> > What am I missing?
> >
> > regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
>
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-14 05:52:30
Message-ID: 5343.1029304350@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> ... I think I'll bite the bullet and store the ON COMMIT data in the
> system catalogues per SQL99. Thoughts?

Seems like the very hard way, considering that there's no reason at all
for the ON COMMIT status to survive a given backend run. I'd certainly
vote against adding pg_class columns for it, if that's what you had
in mind.

I don't much like reintroducing the backend-local list of temp tables
that existed in earlier releases, but maybe that's the best way to
handle this feature. Anyone see a better way?

> ... I would like to get this into 7.3, along with all the other
> patches or features I've put my hand up for. What will be the
> effective cut off for patches of this nature given 7.3 beta at the end
> of the month.

End of the month of course ... but I will say that the standards are
going to rise as we get closer to the end. Patches submitted in the
last week or so had better be right the first time.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-14 06:05:08
Message-ID: 200208140605.g7E659o03698@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > ... I think I'll bite the bullet and store the ON COMMIT data in the
> > system catalogues per SQL99. Thoughts?
>
> Seems like the very hard way, considering that there's no reason at all
> for the ON COMMIT status to survive a given backend run. I'd certainly
> vote against adding pg_class columns for it, if that's what you had
> in mind.
>
> I don't much like reintroducing the backend-local list of temp tables
> that existed in earlier releases, but maybe that's the best way to
> handle this feature. Anyone see a better way?

I never did like that backend-local list of temp rels. It was too hard
to make it obey the table semantics. I guess if you listed them by oid
you could get it to work.

Seems we should be able to put this info somewhere in the system tables.
Could we throw it into pg_description? We have paired down those system
tables so far there isn't a place to stash random stuff.

>
> > ... I would like to get this into 7.3, along with all the other
> > patches or features I've put my hand up for. What will be the
> > effective cut off for patches of this nature given 7.3 beta at the end
> > of the month.
>
> End of the month of course ... but I will say that the standards are
> going to rise as we get closer to the end. Patches submitted in the
> last week or so had better be right the first time.

Yep, we are not going to reject the stuff, but we are going to look at
it _really_ well. :-)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-27 04:29:35
Message-ID: 200208270429.g7R4TZq14356@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Gavin, how are you doing with this. As I remember, the only remaining
issue was where to store the 'drop on commit' information in the
backend. If that is all there is, we can come up with a solution.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 9 Aug 2002, Tom Lane wrote:
>
> > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > template1=# create temp table a (a int) on commit drop;
> > > ERROR: You must be inside a transaction to use ON COMMIT
> >
> > Surely that's only for ON COMMIT DROP, if you intend to offer the
> > others?
>
> I should have provided details of this in the email. SQL99 details the
> baviour as follows:
>
> If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
> DELETE ROWS is implicit
>
> This might give users a bit of a surprise so the effective behaviour is ON
> COMMIT PRESERVE ROWS.
>
> As for your question (and, perhaps, SQL99) I don't seen how it makes any
> sense to specify ON COMMIT outside of a transaction block.
>
> >
> > regards, tom lane
> >
>
> Gavin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-27 05:20:30
Message-ID: Pine.LNX.4.21.0208271515440.5655-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce,

I have a working patch for this I just need to test it further. It occured
to me that there was a bug with the previous implementation in as much as
it didn't handle situations where the user dropped the temp table in a
transaction block. As such, I have added a flag to the structure marking
it dead. This also needs to be undone at ABORT :-). (I knew there was a
reason for storing the ON COMMIT flag in the system catalogs).

Once I have tested further I will send off. If I come across a problem or
cannot get to this by Wednesday (tomorrow) I will send them off to Neil
Conway so that they can make it in. (Unfortunately, I am v. busy atm).

Gavin

On Tue, 27 Aug 2002, Bruce Momjian wrote:

>
> Gavin, how are you doing with this. As I remember, the only remaining
> issue was where to store the 'drop on commit' information in the
> backend. If that is all there is, we can come up with a solution.
>
> ---------------------------------------------------------------------------
>
> Gavin Sherry wrote:
> > On Fri, 9 Aug 2002, Tom Lane wrote:
> >
> > > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > > template1=# create temp table a (a int) on commit drop;
> > > > ERROR: You must be inside a transaction to use ON COMMIT
> > >
> > > Surely that's only for ON COMMIT DROP, if you intend to offer the
> > > others?
> >
> > I should have provided details of this in the email. SQL99 details the
> > baviour as follows:
> >
> > If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
> > DELETE ROWS is implicit
> >
> > This might give users a bit of a surprise so the effective behaviour is ON
> > COMMIT PRESERVE ROWS.
> >
> > As for your question (and, perhaps, SQL99) I don't seen how it makes any
> > sense to specify ON COMMIT outside of a transaction block.
> >
> > >
> > > regards, tom lane
> > >
> >
> > Gavin
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
>
>


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Gavin Sherry" <swm(at)linuxworld(dot)com(dot)au>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-27 05:21:42
Message-ID: GNELIHDDFBOCMGBFGEFOIEOKCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

What about Gavin's CREATE OR REPLACE stuff?

Chris

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Gavin Sherry
> Sent: Tuesday, 27 August 2002 1:21 PM
> To: Bruce Momjian
> Cc: Tom Lane; pgsql-hackers(at)postgresql(dot)org; pgsql-patches(at)postgresql(dot)org
> Subject: Re: [HACKERS] [PATCHES] CREATE TEMP TABLE .... ON COMMIT
>
>
> Bruce,
>
> I have a working patch for this I just need to test it further. It occured
> to me that there was a bug with the previous implementation in as much as
> it didn't handle situations where the user dropped the temp table in a
> transaction block. As such, I have added a flag to the structure marking
> it dead. This also needs to be undone at ABORT :-). (I knew there was a
> reason for storing the ON COMMIT flag in the system catalogs).
>
> Once I have tested further I will send off. If I come across a problem or
> cannot get to this by Wednesday (tomorrow) I will send them off to Neil
> Conway so that they can make it in. (Unfortunately, I am v. busy atm).
>
> Gavin
>
> On Tue, 27 Aug 2002, Bruce Momjian wrote:
>
> >
> > Gavin, how are you doing with this. As I remember, the only remaining
> > issue was where to store the 'drop on commit' information in the
> > backend. If that is all there is, we can come up with a solution.
> >
> >
> ------------------------------------------------------------------
> ---------
> >
> > Gavin Sherry wrote:
> > > On Fri, 9 Aug 2002, Tom Lane wrote:
> > >
> > > > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > > > template1=# create temp table a (a int) on commit drop;
> > > > > ERROR: You must be inside a transaction to use ON COMMIT
> > > >
> > > > Surely that's only for ON COMMIT DROP, if you intend to offer the
> > > > others?
> > >
> > > I should have provided details of this in the email. SQL99 details the
> > > baviour as follows:
> > >
> > > If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
> > > DELETE ROWS is implicit
> > >
> > > This might give users a bit of a surprise so the effective
> behaviour is ON
> > > COMMIT PRESERVE ROWS.
> > >
> > > As for your question (and, perhaps, SQL99) I don't seen how
> it makes any
> > > sense to specify ON COMMIT outside of a transaction block.
> > >
> > > >
> > > > regards, tom lane
> > > >
> > >
> > > Gavin
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 5: Have you checked our extensive FAQ?
> > >
> > > http://www.postgresql.org/users-lounge/docs/faq.html
> > >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-27 14:08:53
Message-ID: Pine.LNX.4.21.0208271752050.11183-102000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Revised patch is attached.

Passes all regression tests relating to temp tables. (I am getting
regression test issues with privileges.sql, rules.sql, conversion.sql).

Gavin

On Tue, 27 Aug 2002, Bruce Momjian wrote:

>
> Gavin, how are you doing with this. As I remember, the only remaining
> issue was where to store the 'drop on commit' information in the
> backend. If that is all there is, we can come up with a solution.
>
> ---------------------------------------------------------------------------
>
> Gavin Sherry wrote:
> > On Fri, 9 Aug 2002, Tom Lane wrote:
> >
> > > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > > template1=# create temp table a (a int) on commit drop;
> > > > ERROR: You must be inside a transaction to use ON COMMIT
> > >
> > > Surely that's only for ON COMMIT DROP, if you intend to offer the
> > > others?
> >
> > I should have provided details of this in the email. SQL99 details the
> > baviour as follows:
> >
> > If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
> > DELETE ROWS is implicit
> >
> > This might give users a bit of a surprise so the effective behaviour is ON
> > COMMIT PRESERVE ROWS.
> >
> > As for your question (and, perhaps, SQL99) I don't seen how it makes any
> > sense to specify ON COMMIT outside of a transaction block.
> >
> > >
> > > regards, tom lane
> > >
> >
> > Gavin
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
>
>

Attachment Content-Type Size
temprel-doc2.diff.gz application/x-gzip 1001 bytes
temprel9.diff.gz application/x-gzip 4.4 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT
Date: 2002-08-27 21:24:01
Message-ID: 200208272124.g7RLO1L20172@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> Revised patch is attached.
>
> Passes all regression tests relating to temp tables. (I am getting
> regression test issues with privileges.sql, rules.sql, conversion.sql).
>
> Gavin
>
> On Tue, 27 Aug 2002, Bruce Momjian wrote:
>
> >
> > Gavin, how are you doing with this. As I remember, the only remaining
> > issue was where to store the 'drop on commit' information in the
> > backend. If that is all there is, we can come up with a solution.
> >
> > ---------------------------------------------------------------------------
> >
> > Gavin Sherry wrote:
> > > On Fri, 9 Aug 2002, Tom Lane wrote:
> > >
> > > > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > > > template1=# create temp table a (a int) on commit drop;
> > > > > ERROR: You must be inside a transaction to use ON COMMIT
> > > >
> > > > Surely that's only for ON COMMIT DROP, if you intend to offer the
> > > > others?
> > >
> > > I should have provided details of this in the email. SQL99 details the
> > > baviour as follows:
> > >
> > > If TEMPORARY is specified and ON COMMIT is omitted, then ON COMMIT
> > > DELETE ROWS is implicit
> > >
> > > This might give users a bit of a surprise so the effective behaviour is ON
> > > COMMIT PRESERVE ROWS.
> > >
> > > As for your question (and, perhaps, SQL99) I don't seen how it makes any
> > > sense to specify ON COMMIT outside of a transaction block.
> > >
> > > >
> > > > regards, tom lane
> > > >
> > >
> > > Gavin
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 5: Have you checked our extensive FAQ?
> > >
> > > http://www.postgresql.org/users-lounge/docs/faq.html
> > >
> >
> >

Content-Description:

[ Attachment, skipping... ]

Content-Description:

[ Attachment, skipping... ]

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073