Menu

#3865 (ok 4.0) Using like operator on each backslash needs 4 backslash protection

3.5.7
fixed
nobody
Backslash (1)
1
2013-06-11
2013-04-02
Siby
No

search using operator LIKE on backslash needs \\ protection.
Phpmyadmin does only \

Test case :
CREATE TABLE mytab (
id int(11) NOT NULL AUTO_INCREMENT,
caption varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO zzzz.mytab (
id ,
caption
)
VALUES (
NULL , './\.'
);

Try to recover this line using search menu and LIKE %....% option will not enough protected backslash

1 Attachments

Discussion

  • Siby

    Siby - 2013-04-02

    The right sequence should be
    SELECT *
    FROM mytab
    WHERE caption LIKE '%./\\\\.%';

     

    Last edit: Siby 2013-04-02
  • Marc Delisle

    Marc Delisle - 2013-04-03

    I don't understand your test case. After the INSERT, here is what gets inserted (tested in MySQL 5.6.4):

    mysql> select * from mytab;
    +----+---------+
    | id | caption |
    +----+---------+
    |  2 | ./.     |
    +----+---------+
    
     
  • Marc Delisle

    Marc Delisle - 2013-04-03
    • status: open --> pending
     
  • Siby

    Siby - 2013-04-03

    Insert is ok
    The issue is when we try to recover insered line using phpmyadmin screen search interface.
    Unfortunately, some backslash are removed using this text box :(
    So, i will use screenshots to avoid misunderstanding.

    On screen 1 area A, the content of table with only 1 row --> ok
    On screen 2, i try to recover this row using phpmyadmin search screen ( area B )
    area C i use Like %..% operator
    area D input exact sequence like display in screen 1 area A
    Then running query by left click on screen 2 area E
    On screen 3 area F, phpmyadmin return no line
    --> Here we have the issue because line exists in table as shown by screen 1 area A
    The problem is that backslash digit was only replace by double backslash ( as we can see in screen 3 area F close after to LIKE operator )
    For me, the right sequence is four backslash replacement for each backslash in string to find ( example on screen 4 area F )

    Hope that help

     

    Last edit: Siby 2013-04-03
  • Marc Delisle

    Marc Delisle - 2013-04-03
    • status: pending --> open
     
  • Marc Delisle

    Marc Delisle - 2013-04-03

    Could you attach a small export of your table's structure and test data?

     
  • Siby

    Siby - 2013-04-04

    Sure
    Only one row in my table

     
  • Michal Čihař

    Michal Čihař - 2013-04-07
    • summary: Using like operator on each backslash needs 4 backslash protection --> (ok 4.0) Using like operator on each backslash needs 4 backslash protection
    • status: open --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-04-07
    • priority: 5 --> 1
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed