Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?
Date: 2011-08-31 10:17:50
Message-ID: j3l1oe$r4i$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2011-08-30, Emi Lu <emilu(at)encs(dot)concordia(dot)ca> wrote:
> Hi Tom,
>
>>>> select * from tablename
>>>> where not (col1 ~~* any(array['str1%', 'str2%'... 'strN%']));
>>
>>> If next version could have "not ilike ('', '')" added into window
>>> functions, that's will be great!
>>
>> Why? And what's this got to do with window functions?
>
> First, where not (col1 ~~* any(array['str1%', 'str2%'... 'strN%'])) will
> work for me.
>
> But I feel " ilike ('str1', ... 'strN')" is more intuitive, isn't it?

no, "('str1', ... 'strN')" looks a lot like a tuple.

if you know these strings beforehand use a single regular expression
instead because ilike is just regex in drag (postgres uses regex to do
ilike), and while ilike can only check one pattern at a time regex can
check several simultaneously.

foo ~* '^(str1|str2|str3...|strN)$'

--
⚂⚃ 100% natural

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Emi Lu 2011-08-31 12:54:32 Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?
Previous Message Emre Hasegeli 2011-08-31 07:16:17 Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?