Gabriel Fernandez wrote:
> 
> Hi,
> 
> I have some problems using LIKE within strings which have brackets.
> 
> For example if i do:
> 
> select code from codes where code like '(4)' ;
> 
> i do not obtain nothing. But in the DB indeed there is a row whose code
> is '(4)'.
> 
> I have tried to escape the brackets with '\\(4\\)' or with ' \(4\)' but
> it doesn't work.
> 
> How can i do it ?
> 
> Gabi :-)

This appears to work fine on 6.5.3:

=> select * from test;
id|description
--+-----------
 1|(4)        
(1 row)

=> select * from test where description like '(4)';
id|description
--+-----------
 1|(4)        
(1 row)

Are you sure there aren't any leading or trailing spaces in the
code field? If the column type is CHAR instead of VARCHAR or
TEXT, then there will be trailing spaces to the size of the
column specified during table creation. What happens when you
perform a select like:

select code from codes where code like '%(4)%';

Hope that helps, 

Mike Mascari

Reply via email to