Skip site navigation (1) Skip section navigation (2)

Re: FKs on temp tables: hard, or just omitted?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Sander Steffann <steffann(at)nederland(dot)net>
Cc: josh(at)agliodbs(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FKs on temp tables: hard, or just omitted?
Date: 2005-10-29 13:13:18
Message-ID: 20051029131313.GD17490@svana.org (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
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(at)svana(dot)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.

In response to

Responses

pgsql-hackers by date

Next:From: Dave PageDate: 2005-10-29 14:11:39
Subject: Re: FKs on temp tables: hard, or just omitted?
Previous:From: Sander SteffannDate: 2005-10-29 12:54:31
Subject: Re: FKs on temp tables: hard, or just omitted?

pgsql-patches by date

Next:From: Tom LaneDate: 2005-10-29 17:42:42
Subject: Re: FKs on temp tables: hard, or just omitted?
Previous:From: Sander SteffannDate: 2005-10-29 12:54:31
Subject: Re: FKs on temp tables: hard, or just omitted?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group