Re: Proposed feature: Selective Foreign Keys

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed feature: Selective Foreign Keys
Date: 2013-12-02 22:37:11
Message-ID: 38553C89-B8B3-410E-90F1-F563DEC3D249@tomd.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 3 Dec 2013, at 01:34, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> We wanted to apply FK constraints to a very large table, but grandfather in certain cases that didn't meet the constraint. That could have been done very simply using this feature.

Yeah, references to old data is the other obvious case for conditionally turning foreign keys off. I decided against using it as an example when trying to sell the feature as there are much easier workarounds than in the different-parent case, and as a solution it really is a bit more ugly. But I suspect that it’s one that people have to deal with fairly regularly.

It might encourage people to keep e.g. old ids in the same column when they should be putting them in a separate one, but then sometimes you don’t get to just rewrite the schema as there are legacy systems etc etc.

Cheers

Tom

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Piotr Marcinczyk 2013-12-02 22:43:06 Re: Improve timestamp substraction to be DST-aware
Previous Message Andrew Dunstan 2013-12-02 22:35:06 Re: Trust intermediate CA for client certificates