Re: Need to check each element of an array satisfies a foreign key constraint

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Need to check each element of an array satisfies a foreign key constraint
Date: 2021-07-14 05:32:52
Message-ID: ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2021-07-13 at 10:00 -0400, David Gauthier wrote:
> I have a column in a table which is a csv of values and I need to make sure each element of the csv = the PK of that same table.

This won't work, and it is broken by design.

Change your data model to adhere to the first normal form, and the
exercise will be simple.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luca Ferrari 2021-07-14 08:26:31 statistic target and sample rate
Previous Message Laurenz Albe 2021-07-14 05:30:51 Re: PostgreSQL 9.2 high replication lag