Search Postgresql Archives

Re: Is it possible to specify an ESCAPE for a wildcard search using LIKE ANY (...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux