From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Andy Hallam <ahm(at)exel(dot)co(dot)uk> |
Cc: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: LIKE predicate and '\' character |
Date: | 2001-11-07 17:23:27 |
Message-ID: | 20011107092052.M49204-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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).
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2001-11-07 17:26:00 | Re: performance problem with 3-column indexes |
Previous Message | Tom Lane | 2001-11-07 17:21:36 | Re: LIKE predicate and '\' character |