Re: Constants in the foreighn key constraints

From: Mimiko <vbvbrj(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Constants in the foreighn key constraints
Date: 2019-11-25 06:27:08
Message-ID: a492e187-778f-57a0-92c7-130e66d6cd5d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message aleksey ksenzov 2019-11-25 07:21:32 Re: Constants in the foreighn key constraints
Previous Message Michael Paquier 2019-11-25 04:14:28 Re: sql query for postgres replication check