Re: Array of foreign key

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Array of foreign key
Date: 2017-12-23 17:49:04
Message-ID: CAD3a31VzLD9oTf4fewSh2-gHW=cQB7D55KUxTkC1UVKdY274OQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
>
> I don't think you understand how Foreign Key constraints work in
> PostgreSQL.
> PostgreSQL will prevent any insert where the value of a column is not
> within the FK table.
> So you DO NOT need a check constraint or trigger.
>
>
I thought the OP was asking for this feature ("Support for Array ELEMENT
Foreign Keys"):

https://www.postgresql.org/message-id/flat/1343842863(dot)5162(dot)4(dot)camel(at)greygoo(dot)devise-it(dot)lan#1343842863(dot)5162(dot)4(dot)camel@greygoo.devise-it.lan

which would be super-handy, but doesn't actually exist. You can enforce it
yourself with a trigger on both tables, but I still hope this someday gets
included into Postgres!

Ken

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Finzel 2017-12-23 18:11:47 Re: Deadlock between concurrent index builds on different tables
Previous Message Melvin Davidson 2017-12-23 17:24:07 Re: Array of foreign key