Re: Temp rows - is it possible?

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: Mattias Kregert <mattias(at)kregert(dot)se>, TANIDA Yutaka <tanida(at)sra(dot)co(dot)jp>, Boris Popov <boris(at)procedium(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Temp rows - is it possible?
Date: 2003-11-10 17:08:43
Message-ID: 200311101708.hAAH8hQ03739@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> "Mattias Kregert" <mattias(at)kregert(dot)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.

Yep, I think we will have to do that. TODO item?

--
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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-11-10 17:09:57 Re: PGSQL technical documentation
Previous Message Scott Chapman 2003-11-10 16:56:03 Re: SQL-question: returning the id of an insert querry