Bug #412 Queries with escape character "\\%" don't retrieve correct results

Submitted: 9 May 2003 20:02 Modified: 14 May 2003 8:25
Reporter: Miguel Solorzano Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:All OS:Any (All)
Assigned to: CPU Architecture:Any

[9 May 2003 20:02] Miguel Solorzano
Description:
A query like this don't return the result expected:

select * from x1 where xName like '\\%'; 

How to repeat:
create table x1 (xName varchar(100));
  insert into x1 values('\\\\aa-xxxx-yy');
    -- this inserts data:  \\aa-xxxx-yy
      
  select * from x1 where xName like '\\%';
    -- this should match any string with a leading \, however, no rows are returned.
  
  select * from x1 where xName like '\\\%';
    -- this returns 1 row, but it should not.
  
  select * from x1 where xName like '\\\\%';
    -- this works fine, as it should
[14 May 2003 8:25] Indrek Siitan
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

This is described in the manual:
http://www.mysql.com/doc/en/String_comparison_functions.html

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.