Re: syntax sugar for conditional check

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: syntax sugar for conditional check
Дата
Msg-id 32582.1459534090@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: syntax sugar for conditional check  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: syntax sugar for conditional check  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Jim Nasby <Jim.Nasby@BlueTreble.com> 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 of N" you could
do something like "(cond1::int + cond2::int + ...) = 1".  We could
wrap some syntactic sugar around either of these, but it's not clear
to me that it'd be any more useful than a custom SQL function.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: syntax sugar for conditional check
Следующее
От: Robbie Harwood
Дата:
Сообщение: Re: [PATCH v10] GSSAPI encryption support