Re: [HACKERS] temp table oddness?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] temp table oddness?
Date: 1999-09-04 19:52:50
Message-ID: 199909041952.PAA04897@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Yep. Wouldn't the best way be to have the temp system record the
> > transaction id used, and to invalidate all temp entries associated with
> > an aborted transaction. That is how the cache code works, so it seems
> > it should be extended to the temp code.
>
> Yeah, that would work -- add an xact abort cleanup routine that goes
> through the temprel list and removes entries added during the current
> transaction.
>
> AFAICS this only explains the coredump-at-exit business, though.
> I'm particularly baffled by that
> ERROR: cannot find attribute 1 of relation pg_temp.24335.3
> in my last example --- do you understand why that's happening?
>
> regards, tom lane
>

I have added temp invalidation code for aborted transactions:

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

Old behavour:

test=> begin;
BEGIN
test=> create temp table test (x int);
CREATE
test=> create index i_test on test(x);
CREATE
test=> abort;
NOTICE: trying to delete a reldesc that does not exist.
NOTICE: trying to delete a reldesc that does not exist.
ABORT
test=> create temp table test (x int);
ERROR: Relation 'test' already exists

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

New behavour:

test=> begin;
BEGIN
test=> create temp table test (x int);
CREATE
test=> create index i_test on test(x);
CREATE
test=> abort;
NOTICE: trying to delete a reldesc that does not exist.
NOTICE: trying to delete a reldesc that does not exist.
ABORT
test=> create temp table test(x int);
CREATE

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-04 21:13:44 Re: [HACKERS] temp table oddness?
Previous Message Peter Blazso 1999-09-04 19:27:42 Re: [HACKERS] array manipulations