Re: BUG #13289: ANY() function produces a paradox

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: BUG #13289: ANY() function produces a paradox
Дата
Msg-id 20150515050115.GB2523@alvh.no-ip.org
обсуждение исходный текст
Ответ на BUG #13289: ANY() function produces a paradox  (udtelco@gmail.com)
Ответы Re: BUG #13289: ANY() function produces a paradox  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
udtelco@gmail.com wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13289
> Logged by:          Anton
> Email address:      udtelco@gmail.com
> PostgreSQL version: 9.3.2
> Operating system:   Solaris 11.2
> Description:
>
> select ('2' != any('{2,3}')) , ('2' = any('{2,3}'))
>
> When != (or <>) operator is applied to any() , results are wrong. Thereby,
> you have a situation where x = y AND x != y both evaluating as true.

There is no paradox here.  When you specify "op ANY array", the operator is
applied to each element in the array and the whole construct returns
true if the operator yields true with any of the array elements.  2 != 3
therefore 2 != any ('{2,3}') is true.

Maybe you want != ALL instead of != ANY.  With != ALL, the element would
be compared to every element and the whole construct would yield true
only if all the operations yield true.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #13289: ANY() function produces a paradox
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #13289: ANY() function produces a paradox