pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: David Gauthier <davegauthierpg@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Need to check each element of an array satisfies a foreign key constraint
Date: Wed, 14 Jul 2021 07:32:52 +0200
Message-ID: <ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at> (raw)
In-Reply-To: <CAMBRECBOOybGgVKHe_E6MYqY7VJ-rS4YME8SwpK5+baAg3cRgg@mail.gmail.com>
References: <CAMBRECBOOybGgVKHe_E6MYqY7VJ-rS4YME8SwpK5+baAg3cRgg@mail.gmail.com>

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






view thread (5+ messages)

Message-ID: <ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at>
Permalink:  ../ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at/
Also on:    postgresql.org/message-id/ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, davegauthierpg@gmail.com
  Subject: Re: Need to check each element of an array satisfies a foreign key constraint
  In-Reply-To: <ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at>
  References: <CAMBRECBOOybGgVKHe_E6MYqY7VJ-rS4YME8SwpK5+baAg3cRgg@mail.gmail.com> <ffbc800d1881a1561b03e8469337ef1242e5aca4.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox