From: Mimiko <vbvbrj@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Constants in the foreighn key constraints
Date: Mon, 25 Nov 2019 08:27:08 +0200
Message-ID: <a492e187-778f-57a0-92c7-130e66d6cd5d@gmail.com> (raw)
In-Reply-To: <CAB5pSh6Hdw6A6hLAQ+d--6vPzxOs6=Ad4kk5DBei91iirZLNPQ@mail.gmail.com>
References: <CAB5pSh6Hdw6A6hLAQ+d--6vPzxOs6=Ad4kk5DBei91iirZLNPQ@mail.gmail.com>
As a workaround, create a table with only one column and one value = `false` and foreign to it.
On 22.11.2019 16:32, aleksey ksenzov wrote:
> Latest time we faced several issues which wouldn't arise provided we have possibility to use constants in foreign key constraints.
> brief example where it would be helpful:
>
> table_a
> ( id uuid,
> parent_id uuid,
> is_deleted boolean
> )
> having possibility of FK (parent_id, false) to (id, is_deleted)
> would disallow setting parent record deleted flag to true if they have children, or insert record with is_deleted = true parent.
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: vbvbrj@gmail.com
Subject: Re: Constants in the foreighn key constraints
In-Reply-To: <a492e187-778f-57a0-92c7-130e66d6cd5d@gmail.com>
References: <CAB5pSh6Hdw6A6hLAQ+d--6vPzxOs6=Ad4kk5DBei91iirZLNPQ@mail.gmail.com> <a492e187-778f-57a0-92c7-130e66d6cd5d@gmail.com>
* 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