Re: [PATCH] Support for Array ELEMENT Foreign Keys

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Support for Array ELEMENT Foreign Keys
Date: 2012-10-19 20:06:43
Message-ID: 5081B2D3.3070604@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/19/2012 03:55 PM, Tom Lane wrote:

> This thought also crystallizes something else that had been bothering me,
> which is that "ELEMENT" alone is a pretty bad choice of syntax because
> it entirely fails to make clear which of these semantics is meant.
> I'm tempted to propose that we use
>
> FOREIGN KEY (foo, EACH ELEMENT OF bar) REFERENCES ...
>
> which is certainly more verbose than just "ELEMENT" but I think it
> makes it clearer that each array element is required to have a match
> separately. If we ever implemented the other behavior it could be
> written as "ANY ELEMENT OF".
>
> That doesn't get us any closer to having a working column-constraint
> syntax unfortunately, because EACH is not a reserved word either
> so "EACH ELEMENT REFERENCES" still isn't gonna work. I'm getting
> more willing to give up on having a column-constraint form of this.
>
>

"ALL" is a fully reserved keyword. Could we do something like "ALL
ELEMENTS"?

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-10-19 20:21:46 Re: [PATCH] Support for Array ELEMENT Foreign Keys
Previous Message Tom Lane 2012-10-19 20:02:52 Re: hash_search and out of memory