Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date
Msg-id 87fwu29d8d.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
>   The incremental FK checks are designed on the assumption that the
> constraint condition held before; they aren't likely to behave very
> sanely if the data is bad.  I'd want to see a whole lot more analysis of
> the resulting behavior before even considering an idea like this.
 ALTER TABLE foo DISABLE TRIGGER ALL;

I must have missed the point when PostgreSQL stoped providing this foot
gun already, so that it's arguable less a surprise to spell the
misfeature NOT ENFORCED rather than DISABLE TRIGGER.

Seriously, real-world use cases such as Kevin's one seems to warrant
that we are able to create a table withouth enforcing the FK. That's
horrid, yes, that's needed, too. Maybe some operations would have to be
instructed that the constraint ain't trustworthy but just declared to be
so by the user?

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


pgsql-hackers by date:

Previous
From: Yeb Havinga
Date:
Subject: Re: proposal : cross-column stats
Next
From: tv@fuzzy.cz
Date:
Subject: Re: proposal : cross-column stats