Re: [HACKERS] temp table oddness? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] temp table oddness?
Date
Msg-id 24349.936461404@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] temp table oddness?  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] temp table oddness?  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Here's another case that doesn't work too well:

regression=> create table u1(i int);
CREATE
regression=> insert into u1 values(1);
INSERT 150665 1
regression=> insert into u1 values(1);
INSERT 150666 1
regression=> create temp table u1(i int);
CREATE
regression=> create unique index i_u1 on u1(i);
CREATE
regression=> select * from u1;        -- yup, temp table is empty
i
-
(0 rows)

regression=> drop table u1;        -- drop temp table
DROP
regression=> select * from u1;        -- ok, we're back to permanent u1
i
-
1
1
(2 rows)

regression=> begin;
BEGIN
regression=> create temp table u1(i int);
CREATE
regression=> create unique index i_u1 on u1(i);
ERROR:  Cannot create index: 'i_u1' already exists
-- apparently, dropping a temp table doesn't drop its temp indexes?
regression=> end;
END
regression=> select * from u1;
ERROR:  cannot find attribute 1 of relation pg_temp.24335.3
-- oops, what's causing this?  Shouldn't the xact have been rolled back
-- due to error?
regression=> \q
-- backend coredumps on quit


Looks like indexes on temp tables need some serious work :-(
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] temp table oddness?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] temp table oddness?