Re: [PATCH] Support for Array ELEMENT Foreign Keys

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>
Subject: Re: [PATCH] Support for Array ELEMENT Foreign Keys
Date: 2012-10-22 16:25:42
Message-ID: 50857386.4040201@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/22/2012 12:13 PM, Andres Freund wrote:
> On Monday, October 22, 2012 06:08:32 PM Tom Lane wrote:
>> I wrote:
>>> I tested, and indeed this seems to work:
>>> CREATE TABLE t1 (c int[] WHERE EACH ELEMENT REFERENCES t2);
>>>
>>> and it's perfectly sensible from an English-grammar standpoint too.
>>> If we take that, how would we spell the table-constraint case exactly?
>>> Grammatically I'd prefer
>>>
>>> FOREIGN KEY (foo, EACH ELEMENT OF bar) REFERENCES
>> Are people happy with these syntax proposals, or do we need some other
>> color for the bikeshed?
> Except that I'd prefer a WHERE in the table-constraint case as well for
> consistencies sake I am unsurprisingly happy with the proposal.

That would look odd too, especially if the array isn't the last element
in the FK:

FOREIGN KEY (foo, WHERE EACH ELEMENT OF bar, baz) REFERENCES

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sebastien FLAESCH 2012-10-22 16:53:54 Re: Database object names and libpq in UTF-8 locale on Windows
Previous Message Tom Lane 2012-10-22 16:17:33 Re: [v9.3] Row-Level Security