Re: LIKE predicate and '\' character
От | Stephan Szabo |
---|---|
Тема | Re: LIKE predicate and '\' character |
Дата | |
Msg-id | 20011107092052.M49204-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | LIKE predicate and '\' character ("Andy Hallam" <ahm@exel.co.uk>) |
Список | pgsql-hackers |
On Wed, 7 Nov 2001, Andy Hallam wrote: > PostgreSQL - 7.1.3 (installed on Linux 2.4.2-2) > PSQLODBC.DLL - 07.01.0007 > Visual C++ - 6.0 > > I sent a previous mail with regard to using the '\' (backslash) character in > an SQL SELECT statement. > The outcome was that postgres does not escape the '\' itself - I need to do > it myself before submitting the SQL - fair enough, I now do this. > > i.e > instead of > mydb=# SELECT * FROM users WHERE id = 'WORKGROUP\me'; > I now do > mydb=# SELECT * FROM users WHERE id = 'WORKGROUP\\me'; > > BUT, if I use the LIKE predicate I have to escape the escape. > > i.e > mydb=# SELECT * FROM users WHERE id LIKE 'WORKGROUP\\\\me'; > > > Now this must be treated as a bug. Postgres *also* treats \ as the default LIKE escape character. Use LIKE '<string>' ESCAPE '' (or some other character if you want to use the like escaping for %, etc).
В списке pgsql-hackers по дате отправления: