Re: [PATCH] Support for Array ELEMENT Foreign Keys

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

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Oct 22, 2012 at 12:08 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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?

> Well, I can't say I'm very happy with the discrepancy between the two
> syntaxes, but I guess I'm in the minority. Still, I can't help but
> think it's going to be confusing and hard to remember. If we don't
> get complaints about it, I'll take that as evidence that the feature
> isn't being used, rather than evidence that the syntax is
> satisfactory.

I'm not thrilled with the inconsistency either, but given the
constraints we're under, it seems like the best we can do. (I feel,
as Andrew does, that shoving WHERE into the table-constraint syntax
would not be an improvement; but the column-constraint syntax really
needs to start with a fully-reserved word). Have you got a better
proposal?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-10-22 18:34:29 Re: ToDo: KNN Search should to support DISTINCT clasuse?
Previous Message Robert Haas 2012-10-22 18:04:00 Re: [PATCH] Support for Array ELEMENT Foreign Keys