Re: Using regexp_matches in the WHERE clause

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Using regexp_matches in the WHERE clause
Date: 2012-11-27 12:35:48
Message-ID: CAFj8pRCpvb-V=wHKkfsb4i371nnWfEJAm06uxJzS-Qaknq88iQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2012/11/27 Thomas Kellerer <spam_eater(at)gmx(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Johnston 2012-11-27 14:22:08 Re: Using regexp_matches in the WHERE clause
Previous Message Thomas Kellerer 2012-11-27 12:30:59 Re: Using regexp_matches in the WHERE clause