Re: array in postgre

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: array in postgre
Дата
Msg-id 1089362472.29095.42.camel@braydb
обсуждение исходный текст
Ответ на array in postgre  (gavaneh <gavaneh@yahoo.com>)
Список pgsql-novice
On Thu, 2004-07-08 at 06:20, gavaneh wrote:
> Hi
>
> suppose we have the following query:
> select ....from ...where...and x *=3;
>
> "x" is an integer array,here we want to check whether
> "x" contains 3 or not,this is the same as one of
> postgre documentaion example,however it doesnt
> work.(why???)
>
> should I set any option? any idea?

From the documentation:

        9.17.3. ANY/SOME (array)
        expression operator ANY (array expression)
        expression operator SOME (array expression)

        The right-hand side is a parenthesized expression, which must
        yield an array value. The left-hand expression is evaluated and
        compared to each element of the array using the given operator,
        which must yield a Boolean result. The result of ANY is "true"
        if any true result is obtained. The result is "false" if no true
        result is found (including the special case where the array has
        zero elements).

        SOME is a synonym for ANY

So in your case:
SELECT ... FROM .. WHERE ... 3 = ANY (x);


Oliver Elphick


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

Предыдущее
От: mike g
Дата:
Сообщение: Re: [LONG] Need help on pg_dump!
Следующее
От: Dmitry Karasik
Дата:
Сообщение: Speed of the stored procedures?