From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Rob Wultsch <wultsch(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED |
Date: | 2010-12-13 02:24:19 |
Message-ID: | 4D0583D3.9000001@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/12/2010 08:27 PM, Rob Wultsch wrote:
>
> MySQL does in fact have this feature and it is used by mysqldump. This
> feature is very useful.
>
The trouble is that FK's have more than one use. In particular, they
have a documentary use that's used by tools that analyze databases, as
well as by tools like htsql. They also have a role as an enforced
constraint.
In fact it's possible now to disable FK enforcement, by disabling the
triggers. It's definitely a footgun though. Just the other day I was
asked how data violating the constraint could have got into the table,
and caused some surprise by demonstrating how easy this was to produce.
So what would actually be an advance in my view would be a mechanism
that allowed explicit disabling of a constraint but ensured that it was
not violated when re-enabling it.
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2010-12-13 02:28:22 | Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED |
Previous Message | Tomas Vondra | 2010-12-13 02:16:31 | Re: proposal : cross-column stats |