MariaDB 错误?喜欢逃离破碎

MariaDB Bugs? LIKE Escaping Broken

服务器版本:10.1.21-MariaDB-1~jessie

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

like 子句代表 'wildcard + literal % + literal %' 但它匹配 'a%b'.

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

MySQL 5.5.38 returns 两个语句都为 0。 MariaDB的语法有什么不同吗?


添加

@rahul 指出语法错误,所以我创建了一个虚拟 table 和 运行

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

匹配 table.

中的每一行

但是,当我 运行

时,field1='a%b' 的行不匹配
SELECT * from `table` where field1 like '%\%\%';

现在将在 10.1.22 进行测试。

这似乎已在 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)