Re: FKey not enforced resulting in broken Dump/Reload

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Rod Taylor <rod(dot)taylor(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FKey not enforced resulting in broken Dump/Reload
Date: 2013-07-19 17:45:32
Message-ID: 10452.1374255932@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Jul 19, 2013 at 12:58 PM, Rod Taylor <rod(dot)taylor(at)gmail(dot)com> wrote:
>> A poorly coded trigger on the referencing table has the ability to break
>> foreign keys, and as a result create a database which cannot be dumped and
>> reloaded.

> This is a known limitation of our foreign key machinery. It might
> well be susceptible to improvement, but I wouldn't count on anyone
> rewriting it in the near future.

If we failed to fire triggers on foreign-key actions, that would not be
an improvement. And trying to circumscribe the trigger's behavior so
that it couldn't break the FK would be (a) quite expensive, and
(b) subject to the halting problem, unless perhaps you circumscribed
it so narrowly as to break a lot of useful trigger behaviors. Thus,
there's basically no alternative that's better than "so don't do that".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2013-07-19 17:46:11 Re: Foreign Tables as Partitions
Previous Message Tom Lane 2013-07-19 17:36:22 Re: AGG_PLAIN thinks sorts are free