Re: Escape wildcard problems.

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Escape wildcard problems.
Дата
Msg-id 20081024155010.GK2459@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Escape wildcard problems.  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Список pgsql-general
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

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

Предыдущее
От: Harald Fuchs
Дата:
Сообщение: Re: Query m:n-Combination
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: Escape wildcard problems.