Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread David G. Johnston
On Fri, Apr 1, 2016 at 3:22 PM, Jim Nasby wrote: > On 4/1/16 1:08 PM, Tom Lane wrote: > >> Jim Nasby writes: >> >>> Rather than this, I think an exclusive-or operator would be a lot more >>> useful. The only difficulty I run into with CHECK

Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread Jim Nasby
On 4/1/16 1:08 PM, Tom Lane wrote: Jim Nasby writes: 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. "bool != bool" works as

Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread Tom Lane
Jim Nasby writes: > 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. "bool != bool" works as XOR. If you need "exactly one

Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread Pavel Stehule
2016-04-01 18:57 GMT+02:00 David G. Johnston : > On Thu, Mar 31, 2016 at 10:19 AM, Alexander Ostrow wrote: > >> Hello, >> >> I thought it would be cool to have conditional check syntax, which gets >> converted to simple check constraint syntax. >> >>

Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread Jim Nasby
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

Re: [HACKERS] syntax sugar for conditional check

2016-04-01 Thread David G. Johnston
On Thu, Mar 31, 2016 at 10:19 AM, 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

[HACKERS] syntax sugar for conditional check

2016-04-01 Thread Alexander Ostrow
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