Re: "like any" in reverse? - Mailing list pgsql-general

From Tom Lane
Subject Re: "like any" in reverse?
Date
Msg-id 18453.1265951315@sss.pgh.pa.us
Whole thread Raw
In response to "like any" in reverse?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
"Gauthier, Dave" <dave.gauthier@intel.com> writes:
> I want to find all records where any element of lst like 'j%'.
> This does not work...
> select * from foo where 'j%' like any(lst);

> Intuitively, you'd think....
> select * from foo where any(lst) like 'j%';
> ... but that's a syntax error.

Yeah, the ANY has to be on the right-hand side of the operator.
What you can do for this is build yourself a "reverse like"
operator, ie flip the left and right arguments within the function.
I'm pretty sure there are worked-out examples in the archives
if that's not enough of a hint for you.

            regards, tom lane

pgsql-general by date:

Previous
From: u235sentinel
Date:
Subject: Re: Postgres Triggers issue
Next
From: Magnus Hagander
Date:
Subject: Re: Postgres standard versus Postgres Plus Advanced Server