Re: operator contains in older Pgsql

From: "W(dot) Kinastowski" <kinastowski(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: operator contains in older Pgsql
Date: 2009-08-18 10:16:58
Message-ID: 4A8A7F9A.3070906@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jasen Betts wrote:
> On 2009-08-18, W. Kinastowski <kinastowski(at)gmail(dot)com> wrote:
>
>> I need a functionality of "@>" array operator in 8.1 Pg server. i.ex.
>> SELECT * FROM table WHERE array_col @> ARRAY ['xxx'] (works in 8.2,
>> error in 8.1)
>> How to performe such a query ? Is it possible ? Thanks for help.
>>
>
> SELECT * FROM table WHERE 'xxx' = ANY( array_col )
>
>
>
thanks, it works ... and when there is more elements in array: i.ex
SELECT * FROM table WHERE array_col @> ARRAY ['xxx', 'yyy']
i need to
SELECT * FROM table WHERE 'xxx' = ANY( array_col ) AND 'yyy' = ANY(
array_col )
is that correct ?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2009-08-18 11:18:10 Re: operator contains in older Pgsql
Previous Message Jasen Betts 2009-08-18 09:44:23 Re: operator contains in older Pgsql