Re: Temp rows - is it possible? - Mailing list pgsql-general

From Tom Lane
Subject Re: Temp rows - is it possible?
Date
Msg-id 18567.1068475172@sss.pgh.pa.us
Whole thread Raw
In response to Re: Temp rows - is it possible?  ("Mattias Kregert" <mattias@kregert.se>)
Responses Re: Temp rows - is it possible?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Temp rows - is it possible?  (Robert Creager <Robert_Creager@LogicalChaos.org>)
Re: Temp rows - is it possible?  (TANIDA Yutaka <tanida@sra.co.jp>)
List pgsql-general
"Mattias Kregert" <mattias@kregert.se> writes:
> This is great!

>> create table a(...);
>> insert into a(...); # fixed values
>>
>> create table b() inherits (a);
>> insert into b values(...); # temporary values
>>
>> select * from a; # You can get both global and temporary values.

I don't think it's actually reliable.  B was meant to be a temp table,
right?  The problem is that B will be globally visible to all sessions
as being a child table of A, but because temp tables are processed in
backend-local buffers, it will be quite erratic whether other sessions
can see the rows you've inserted.  In an experiment just now, another
session could not see the rows in B until I'd inserted several thousand
of them (enough to overrun the local buffers) ... and then the other
session could see some but not all of them.

We recently decided we had to forbid foreign-key references from temp
tables to permanent tables because of this effect.  I wonder whether
we won't end up forbidding temp tables as children of permanent tables
too.

            regards, tom lane

pgsql-general by date:

Previous
From: Rajesh Kumar Mallah
Date:
Subject: Re: PL/PGSQL help for getting number of rows matched.
Next
From: "Philippe Lang"
Date:
Subject: Dynamic expression evaluation