Question about the ANY operator

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Question about the ANY operator
Date: 2009-12-21 10:46:59
Message-ID: 7aa638e00912210246p29bba173wea0488931d2fe7ac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm having trouble figuring out the ANY operator.. Basically I want to
return rows that match any of the given IDs:

select Name from Users where UserId = ANY
ARRAY['948aeda5-ffff-41bd-af4e-71d1c740db76',
'5ee315ea-7ef6-4fa5-809a-dc9931a01ed1']::uuid[];

I get the syntax error:

ERROR: syntax error at or near "ARRAY"
LINE 1: ...* from Users where UserId = ANY ARRAY['948...

I know I could just use a bunch of OR clauses, but I want to pass in this
array as a variable. Any clue as to what I'm doing wrong?

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Voras 2009-12-21 10:48:24 Re: Something like Oracle Forms, but Open Source to use with PostgreSQL?
Previous Message Alban Hertroys 2009-12-21 10:45:10 Re: Charset Win1250 on Windows and Ubuntu