From: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is it possible to specify an ESCAPE for a wildcard search using LIKE ANY (...) |
Date: | 2017-01-17 13:42:27 |
Message-ID: | 20170117134226.vmwb3dfmqcpy2ezx@hermes.hilbert.loc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jan 17, 2017 at 09:25:38AM +0100, Thomas Kellerer wrote:
> I recently stumbled over the need to use a wildcard escape character for a condition that makes use of LIKE ANY, something like:
>
> select *
> from some_table
> where name like any (array['foo_bar%', 'bar_foo%']) escape '/';
>
> so that the underscore wouldn't be treated as a wildard
May I ask for clarification:
Do you need to have the _ NOT be recognized as a wildcard ?
Or do yo need to have the _ be used as an escape character ?
In the latter case I wonder whether the example was an
unlucky choice since neither "b" nor "f" need escaping. Am I
understanding you correctly that you need '_%' to have the
meaning '\%' normally would in the context of a LIKE pattern ?
Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2017-01-17 14:27:57 | Re: Is it possible to specify an ESCAPE for a wildcard search using LIKE ANY (...) |
Previous Message | Vik Fearing | 2017-01-17 12:58:21 | Re: Re: Is it possible to specify an ESCAPE for a wildcard search using LIKE ANY (...) |