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

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?
Дата
Msg-id j3l1oe$r4i$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на where col1 not ilike ('str1%', 'str2%'... 'strN%') support?  (Emi Lu <emilu@encs.concordia.ca>)
Список pgsql-sql
On 2011-08-30, Emi Lu <emilu@encs.concordia.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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Emre Hasegeli
Дата:
Сообщение: Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?
Следующее
От: Emi Lu
Дата:
Сообщение: Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support?