Foreign key constraint for array-field?

Поиск
Список
Период
Сортировка
От Dmitry Koterov
Тема Foreign key constraint for array-field?
Дата
Msg-id d7df81620809201738w625efb14o10f7af4d7d35806f@mail.gmail.com
обсуждение исходный текст
Ответы Re: Foreign key constraint for array-field?
Re: Foreign key constraint for array-field?
Re: Foreign key constraint for array-field?
Список pgsql-hackers
Hello.

Is it possible to create a foreign key constraint for ALL elements of
an array field?

CREATE TABLE a(id INTEGER);
CREATE TABLE b(id INTEGER, a_ids INTEGER[]);

Field b.a_ids contains a list of ID's of "a" table. I want to ensure
that each element in b.a_ids exists in a in any time. Is it possible
to create an automatic foreign key?

According to http://www.postgresql.org/docs/current/static/catalog-pg-constraint.html
, seems to me it is possible if I create a custom entry in
pg_constraint with my custom conpfeqop, conppeqop and conffeqop
fields.

Am I right?


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [patch] fix dblink security hole
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [patch] fix dblink security hole