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]

 



Thomas Kellerer <spam_eater@xxxxxxx> writes:
> So my question is: Is there any way to specify an alternate wildcard escape when using LIKE ANY (..)? 

No, not with ESCAPE.  [ manfully resists temptation to run down SQL
committee's ability to design composable syntax ... oops ]

You could do what PG does under the hood, which is to run the pattern
through like_escape():

 select *
   from some_table
   where name like any (array[like_escape('foo_bar%', '/'),
                              like_escape('bar_foo%', '/')]);

If that seems too verbose, maybe build a function to apply like_escape
to each member of an array.

			regards, tom lane


-- 
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