MariaDB errors? Like

Server version: 10.1.21-MariaDB-1 ~ jessie

select 'a%b' like '%\%\%';
+--------------------+
| 'a%b' like '%\%\%' |
+--------------------+
|                  1 |
+--------------------+
1 row in set (0.00 sec)

      

a similar sentence represents "wildcard + literal% + literal%", but it matches "a% b".

or

select 'a%b' like '%\%\%\%\%\%';
+--------------------------+
| 'a%b' like '%\%\%\%\%\%' |
+--------------------------+
|                        1 |
+--------------------------+
1 row in set (0.00 sec)

      

MySQL 5.5.38 returns 0 for both statements. Is MariaDB syntax different?


Add to

@rahul pointed out that the syntax is not correct, so I created a dummy table and ran

SELECT * FROM `table1` where 'a%b' like '%\%\%';

      

which matches every row in the table.

However, the line with field 1 = 'a% b' does not match when I ran

SELECT * from `table` where field1 like '%\%\%';

      

We will now test 10.1.22.

+3


source to share


1 answer


This seems to be fixed in 10.1.22.



Server version: 10.1.22-MariaDB-1~xenial mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select 'a%b' like '%\%\%';
+--------------------+
| 'a%b' like '%\%\%' |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

      

0


source







All Articles