Search Postgresql Archives

Re: Escape wildcard problems.

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

 



On Fri, Oct 24, 2008 at 08:12:38AM -0700, Gauthier, Dave wrote:
> select name from templates where name like '%\_cont\_%';
> 
>           name
> ----------------------------------
> cgidvcontrol
> x8idvcontrol
> etc....
> 
> I would expect to NOT see these because the "cont" is not preceded by
> and followed by an underscore (because I escaped them with \).

You need to escape the escape! backslash is the escape character in
literals as well as like patterns, so you need to double it up.  I think
you want to be doing:

  name LIKE '%\\_cont\\_%'



  Sam

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