Question about WHERE CASE

Поиск
Список
Период
Сортировка
От Mike Martin
Тема Question about WHERE CASE
Дата
Msg-id CAOwYNKYVz67+qK6QfSiJVhCA8fAXzpHLS-L9HG=SEhOUzJ0A1w@mail.gmail.com
обсуждение исходный текст
Ответы Re: Question about WHERE CASE
Re: Question about WHERE CASE
Список pgsql-sql
I have come across the following construct which works in postgres

WHERE CASE WHEN $1=dir THEN TRUE ELSE metadir=$1 END

case when ('yes'= lower($1)) then (phone_number is not null)     when ('no'=lower($1)) then (phone_number is null)     else true end

I was always under the impression that a case expression could only be on the right side of a where expression ie:
WHERE fieldname=<cse expression>

Is this a postgres extention, cant find any documentation on this

thanks

Mike

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

Предыдущее
От: Sebastien FLAESCH
Дата:
Сообщение: Re: libpq: How are result sets fetched behind the scene?
Следующее
От: Martin Stöcker
Дата:
Сообщение: Re: Question about WHERE CASE