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).