Re: Proposed feature: Selective Foreign Keys - Mailing list pgsql-hackers

From Tom Dunstan
Subject Re: Proposed feature: Selective Foreign Keys
Date
Msg-id 805981F6-F25E-4E80-8280-D7A0A7CC6D28@tomd.cc
Whole thread Raw
In response to Re: Proposed feature: Selective Foreign Keys  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On 5 Dec 2013, at 03:48, Andrew Dunstan <andrew@dunslane.net> wrote:
>>> Well I guess we could say something like:
>>>
>>>    FOREIGN KEY (a-col) WHERE (a-condition) REFERENCES b(b-col) WHERE
>>>    (b-condition)
>>>
>
> OK, those make sense. I wonder whether this should be done via a USING clause on the constraint that pointed to the
partialunique index. Or would that be too obscure? 

Well you could put a USING clause on the end and it would read pretty unambiguously. Requiring that the user specify it
ratherthan trying to guess which index to use would also probably be an easier path to getting that feature in, at
leastfor a first cut. 

I won’t be doing work towards putting a where clause on the referenced side just yet, though. One thing at a time.

Cheers

Tom






pgsql-hackers by date:

Previous
From: Tom Dunstan
Date:
Subject: Re: Proposed feature: Selective Foreign Keys
Next
From: Peter Geoghegan
Date:
Subject: Re: Performance optimization of btree binary search