Re: [PATCH] Support for Array ELEMENT Foreign Keys

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Support for Array ELEMENT Foreign Keys
Дата
Msg-id 9553.1350681606@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Support for Array ELEMENT Foreign Keys  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: [PATCH] Support for Array ELEMENT Foreign Keys
Список pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> What about sticking a WHERE in there? I.e. FOREIGN KEY (foo, WHERE EACH 
> ELEMENT OF bar) ...

Well, we don't really need it in the table-constraint case.  The
column-constraint case is the sticking point.

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

but this seems a bit far afield from the column-constraint syntax.
OTOH, that's a pretty minor quibble.  These work according to bison,
and they wouldn't make a grammarian run away screaming, so maybe we
should just be happy with that.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Support for Array ELEMENT Foreign Keys
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Deprecating RULES