Re: Constants in the foreighn key constraints

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: aleksey ksenzov <alekseyksenzov(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Constants in the foreighn key constraints
Date: 2019-11-23 17:02:59
Message-ID: d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/22/19 11:36 PM, aleksey ksenzov wrote:

Please reply to list also.
Ccing list.

> We're already on 12.
>
> While I understand I can do everything with triggers/functions, for me
> it looks like a good idea to have possibility to use constants in
> constraints, so it would be very nice if postgres community could add
> this functionality in the nearest releases.
> Regards,
> Aliaksei.
>
>
> On Fri, Nov 22, 2019 at 4:25 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> On 11/22/19 6:32 AM, aleksey ksenzov wrote:
> > Hi team.
> > 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.
>
> Postgres version?
>
> Look at triggers, in particular CONSTRAINT triggers:
>
> https://www.postgresql.org/docs/12/sql-createtrigger.html
>
> >
> > Regards,
> > Aliaksei.
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jason L. Amerson 2019-11-23 17:03:20 RE: Remote Connection Help
Previous Message Christoph Gößmann 2019-11-23 15:42:02 Re: How to drop all tokens that a snowball dictionary cannot stem?