Re: FKs on temp tables: hard, or just omitted? - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: FKs on temp tables: hard, or just omitted?
Date
Msg-id 20051029131313.GD17490@svana.org
Whole thread Raw
In response to Re: FKs on temp tables: hard, or just omitted?  ("Sander Steffann" <steffann@nederland.net>)
Responses Re: FKs on temp tables: hard, or just omitted?
List pgsql-hackers
On Sat, Oct 29, 2005 at 02:54:31PM +0200, Sander Steffann wrote:
> >You can have foreign keys between temp tables, just not between temp and
> >permanent tables.  The latter case is either fairly silly, or
> >technically hard, depending on which direction you have in mind.
>
> A temp table referencing a permanent table wouldn't be very silly IMHO...
> Sander.

Ok, say someone in another backend deletes a row from the parmanent
table, how do they check that no appropriate rows exist in the temp
table? A foreign keys involves triggers on both the source and target
tables.

You solve it by allowing other backends to lock and examine your
temporary tables. But AIUI temporary tables are not stored in shared
memory so how do you get a consistant view of it?

Not unsolvable, but very tricky.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: "Sander Steffann"
Date:
Subject: Re: FKs on temp tables: hard, or just omitted?
Next
From: "Dave Page"
Date:
Subject: Re: FKs on temp tables: hard, or just omitted?