pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: aleksey ksenzov <alekseyksenzov@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Constants in the foreighn key constraints
Date: Sat, 23 Nov 2019 09:02:59 -0800
Message-ID: <d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com> (raw)
In-Reply-To: <CAB5pSh59gA0zrjfG-vWABn0QNBroWMDB6wT8rCLGwcQKR63zTw@mail.gmail.com>
References: <CAB5pSh6Hdw6A6hLAQ+d--6vPzxOs6=Ad4kk5DBei91iirZLNPQ@mail.gmail.com>
	<85f6184b-cd37-0b7e-9bee-b0d781cead6f@aklaver.com>
	<CAB5pSh59gA0zrjfG-vWABn0QNBroWMDB6wT8rCLGwcQKR63zTw@mail.gmail.com>

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.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.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.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com>
Permalink:  ../d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com/
Also on:    postgresql.org/message-id/d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com

 · 

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: adrian.klaver@aklaver.com, alekseyksenzov@gmail.com
  Subject: Re: Constants in the foreighn key constraints
  In-Reply-To: <d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.com>
  References: <CAB5pSh6Hdw6A6hLAQ+d--6vPzxOs6=Ad4kk5DBei91iirZLNPQ@mail.gmail.com> <85f6184b-cd37-0b7e-9bee-b0d781cead6f@aklaver.com> <CAB5pSh59gA0zrjfG-vWABn0QNBroWMDB6wT8rCLGwcQKR63zTw@mail.gmail.com> <d1fcda01-9944-19bf-8f79-e978c43db172@aklaver.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