Re: Using regexp_matches in the WHERE clause

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Using regexp_matches in the WHERE clause
Дата
Msg-id CAFj8pRCpvb-V=wHKkfsb4i371nnWfEJAm06uxJzS-Qaknq88iQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using regexp_matches in the WHERE clause  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-sql
2012/11/27 Thomas Kellerer <spam_eater@gmx.net>:
> Pavel Stehule, 27.11.2012 13:26:
>
>>> My question is: why I cannot use regexp_matches() in the WHERE clause,
>>> even
>>> when the result is clearly an integer value?
>>>
>>
>> use a ~ operator instead
>>
>
> So that means, regexp_matches cannot be used as an expression in the WHERE

should not be used - it is designed to return matched values, no for
returning true or false,

you can do some obscure
postgres=# select * from o where array(select
(regexp_matches(a,'ne'))[1]) <> '{}'::text[];  a
--------zdenek
(1 row)

but it is not recommended.

Regards

Pavel

> clause?
>
>
> Regards
> Thomas
>
>
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql



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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Using regexp_matches in the WHERE clause
Следующее
От: ssylla
Дата:
Сообщение: output query on many to many relationship into several columns