LIKE predicate and '\' character

From: "Andy Hallam" <ahm(at)exel(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: LIKE predicate and '\' character
Date: 2001-11-07 10:45:22
Message-ID: 9sb3ek$r0k$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.
As you can see it is not an error with the PSQLODBC driver as I ran the SQL
from the command line with the same results.
I am presuming that the backend parsing logic around the LIKE prodicate is
ignoring the '\'.

Is anyone working on this ?. Can anyone send me a fix, as without this I'm
screwed.

Thanks for any help

Andy.
ahm(at)exel(dot)co(dot)uk

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Pilsl 2001-11-07 11:34:21 lower does not handle german umlaut
Previous Message abhay 2001-11-07 10:43:57 a query ...