Re: How to use like with a list

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to use like with a list
Date: 2011-11-18 21:44:59
Message-ID: 482E80323A35A54498B8B70FF2B8798004D5FC885F@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

BINGO !
Thanks :-)

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of John R Pierce
Sent: Friday, November 18, 2011 3:47 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] How to use like with a list

On 11/18/11 12:37 PM, Gauthier, Dave wrote:
> bi_dev=# select name from test where name ~ '^(' || replace('jo,mo,do,fo', ',', '|') || ')l';
> ERROR: argument of WHERE must be type boolean, not type text

ah, needs () around the right side of the ~ expression, not sure why.
does ~ have higher expression priority than || or something?

select name from test where name ~ ('^(' || replace(?, ',', '|') || ')l');

worked for me.

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Cornett 2011-11-18 22:32:59 Re: Is it ever necessary to vacuum a table that only gets inserts/updates?
Previous Message J.V. 2011-11-18 21:23:56 MS SQL Server (2005, 2008) ==> PostgreSQL 9.x