Using backslash in query

Поиск
Список
Период
Сортировка
От Michael Brusser
Тема Using backslash in query
Дата
Msg-id DEEIJKLFNJGBEMBLBAHCIENFDLAA.michael@synchronicity.com
обсуждение исходный текст
Ответ на Re: PostgreSQL not ACID compliant?  ("Heikki Tuuri" <Heikki.Tuuri@innodb.com>)
Ответы Re: Using backslash in query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I'm afraid I'm confused about something very simple... but anyway

I need to run a query on a varchar field containing a backslash.
My first attempt looked like this: SELECT smth. FROM  tbl WHERE situation LIKE '%\\%';
This did not returned any rows.

I looked up for a reference, confirmed that
"... double-backslash is required to represent a literal backslash."
http://www.postgresql.org/docs/aw_pgsql_book/node139.html#copy_backslash_han
dling

But when I doubled the number of backslashes: SELECT smth. FROM  tbl WHERE situation LIKE '%\\\\%';
- it actually worked fine.

Same thing happens with using regex: situation ~ '\\';

Could someone shed some light on this, please.

Mike.





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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Weird locking situation
Следующее
От: Bruno Wolff III
Дата:
Сообщение: timestamp.c is broken (probably by ecpg) in 7.4