pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedoperator contains in older Pgsql
4+ messages / 2 participants
[nested] [flat]
* operator contains in older Pgsql
@ 2009-08-18 07:47 W. Kinastowski <kinastowski@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: W. Kinastowski @ 2009-08-18 07:47 UTC (permalink / raw)
To: pgsql-sql
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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: operator contains in older Pgsql
@ 2009-08-18 09:44 Jasen Betts <jasen@xnet.co.nz>
parent: W. Kinastowski <kinastowski@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jasen Betts @ 2009-08-18 09:44 UTC (permalink / raw)
To: pgsql-sql
On 2009-08-18, W. Kinastowski <kinastowski@gmail.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 )
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: operator contains in older Pgsql
@ 2009-08-18 10:16 W. Kinastowski <kinastowski@gmail.com>
parent: Jasen Betts <jasen@xnet.co.nz>
0 siblings, 1 reply; 4+ messages in thread
From: W. Kinastowski @ 2009-08-18 10:16 UTC (permalink / raw)
To: pgsql-sql
Jasen Betts wrote:
> On 2009-08-18, W. Kinastowski <kinastowski@gmail.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 ?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: operator contains in older Pgsql
@ 2009-08-18 11:18 Jasen Betts <jasen@xnet.co.nz>
parent: W. Kinastowski <kinastowski@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Jasen Betts @ 2009-08-18 11:18 UTC (permalink / raw)
To: pgsql-sql
On 2009-08-18, W. Kinastowski <kinastowski@gmail.com> wrote:
> Jasen Betts wrote:
>> On 2009-08-18, W. Kinastowski <kinastowski@gmail.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 ?
it looks good it to me.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2009-08-18 11:18 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-08-18 07:47 operator contains in older Pgsql W. Kinastowski <kinastowski@gmail.com>
2009-08-18 09:44 ` Jasen Betts <jasen@xnet.co.nz>
2009-08-18 10:16 ` W. Kinastowski <kinastowski@gmail.com>
2009-08-18 11:18 ` Jasen Betts <jasen@xnet.co.nz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox