Re: backslashes in queries containing LIKE

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Mickael Faivre-Macon <faivrem(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: backslashes in queries containing LIKE
Date: 2005-01-26 16:15:55
Message-ID: 20050126161555.GA83314@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 26, 2005 at 02:44:40PM +0100, Mickael Faivre-Macon wrote:

> We have a problem with backslashes in queries containing LIKE.
>
> insert into table (field) values ('IM\\test')
> select * from table where field = 'IM\\test'
>
> returns one record
>
> select * from table where field LIKE 'IM\\%'
>
> returns no record

See the "Pattern Matching" section in the "Functions and Operators"
chapter of the documentation:

http://www.postgresql.org/docs/8.0/static/functions-matching.html

The documentation under "LIKE" discusses issues regarding the escape
character (the backslash by default).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-01-26 16:20:35 Re: Size of data stored in bytea record?
Previous Message Frank D. Engel, Jr. 2005-01-26 16:10:07 Export a column in a view without "announcing" it?