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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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