Re: like query backslash

Поиск
Список
Период
Сортировка
От ksherlock@gmail.com
Тема Re: like query backslash
Дата
Msg-id 1168817163.955192.295590@a75g2000cwd.googlegroups.com
обсуждение исходный текст
Ответ на like query backslash  (Sim Zacks <sim@compulab.co.il>)
Список pgsql-general
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 ''


В списке pgsql-general по дате отправления:

Предыдущее
От: "Doug Cole"
Дата:
Сообщение: Avoiding empty queries in tsearch
Следующее
От: Shane Ambler
Дата:
Сообщение: Re: Performance with very large tables