Skip site navigation (1) Skip section navigation (2)

BUG #5535: Backslash in condition for LIKE statement is not seen

From: "Jeff Benjamin" <jeff(at)ivertex(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5535: Backslash in condition for LIKE statement is not seen
Date: 2010-07-01 20:26:38
Message-ID: 201007012026.o61KQcRr024009@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5535
Logged by:          Jeff Benjamin
Email address:      jeff(at)ivertex(dot)com
PostgreSQL version: 8.3.8
Operating system:   MacOSX, Linux
Description:        Backslash in condition for LIKE statement is not seen
Details: 

Seems one cannot use a backslash character in a LIKE condition.

backslashprob=# create table test ( pattern varchar(50) );
CREATE TABLE
backslashprob=# insert into test (pattern) values ('\\w{12}');
INSERT 0 1
backslashprob=# select * from test;
 pattern 
---------
 \w{12}
(1 row)

backslashprob=# select * from test where pattern like '\\w%';
 pattern 
---------
(0 rows)

backslashprob=# select * from test where pattern like E'\\w%';
 pattern 
---------
(0 rows)

backslashprob=# select * from test where pattern like '%w%';
 pattern 
---------
 \w{12}
(1 row)

Responses

pgsql-bugs by date

Next:From: Kevin GrittnerDate: 2010-07-01 20:34:56
Subject: Re: BUG #5535: Backslash in condition for LIKE statement is not seen
Previous:From: Tom LaneDate: 2010-07-01 18:06:20
Subject: Re: BUG #5531: REGEXP_ REPLACE causes connection drop

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group