Re: LIKE IN

From: David Wheeler <david(at)kineticode(dot)com>
To: josh(at)agliodbs(dot)com
Cc: sfpug(at)postgresql(dot)org
Subject: Re: LIKE IN
Date: 2004-03-02 05:53:39
Message-ID: F4686402-6C0D-11D8-A088-000A95972D84@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

On Mar 1, 2004, at 9:41 PM, Josh Berkus wrote:

> I think it would be possible to implement a "value LIKE (
> 'x%','y%','z%')" in
> postgreSQL but you'd have to get someone interested in hacking it.

Actually, this works:

select 'a' ~~ ANY (SELECT 'a' UNION SELECT 'b');

It's a little ugly, though. In 7.4, you can use this:

SELECT 'a' ~~ ANY(array['a%','b%']);

Which is slightly better. But I think I'll stick to this for now:

SELECT * from element where name LIKE 'a%' OR name LIKE 'b%';

Regards,

David

In response to

Browse sfpug by date

  From Date Subject
Next Message Fred Moyer 2004-03-12 11:30:20 Re: Reminder: Meeting Next Week -- RSVP Please
Previous Message Josh Berkus 2004-03-02 05:41:30 Re: LIKE IN