Search Postgresql Archives

Re: like query backslash

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

 



Sim Zacks wrote:
> To retrieve the above example, I needed to query:
> select * from filetable where filename like '\\\\\\\\server\\\\dir%'
>
> Is this a bug or is there a reason for this?
>
> Sim

There's a reason.  With like queries, if you want to search for the
literal characters % or ?  they need to be escaped with a \.  So
essentially, the entire string is \ escaped twice.  The good news is,
you can redefine the escape character in your query.

eg

select * from filetable where filename like '\\\\server\\dir%' escape ''



[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