Re: syntax sugar for conditional check

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Alexander Ostrow <aj(at)epcylon(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: syntax sugar for conditional check
Date: 2016-04-01 17:45:33
Message-ID: 56FEB3BD.9070305@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/31/16 12:19 PM, Alexander Ostrow wrote:
> Hello,
>
> I thought it would be cool to have conditional check syntax, which gets
> converted to simple check constraint syntax.
>
> Here’s a gist:
>
> https://gist.github.com/aj0strow/5a07f2ddcad324c4dac2c4095c821999
>
> It’s just sugar, but i think it would make check constraints easier to
> read, and easier to write without backwards boolean logic.

Rather than this, I think an exclusive-or operator would be a lot more
useful. The only difficulty I run into with CHECK constaints is when I
want to ensure that only ONE condition is true.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karl O. Pinc 2016-04-01 17:53:21 Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support
Previous Message Oleg Bartunov 2016-04-01 17:08:33 Re: [PATCH] Phrase search ported to 9.6