Description:
Table structure:
CREATE TABLE `test_json` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`info` json DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT DEFAULT CHARSET=gb2312;
Table rows:
id info
1 {"age": 10, "name": "foo"}
2 {"age": 15, "name": "boo"}
WHEN execute query:
select * from test_json where info -> '$.name' in ('foo');
then return row 1;
WHEN execute query:
select * from test_json where info -> '$.name' in ('foo', 'boo');
then return empty;
How to repeat:
table structure:
CREATE TABLE `test_json` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`info` json DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT DEFAULT CHARSET=gb2312;
table data:
INSERT INTO `test`.`test_json` (`id`, `info`) VALUES (1, '{\"age\": 10, \"name\": \"foo\"}');
INSERT INTO `test`.`test_json` (`id`, `info`) VALUES (2, '{\"age\": 15, \"name\": \"boo\"}');
WHEN execute query:
select * from test_json where info -> '$.name' in ('foo');
then return row 1;
WHEN execute query:
select * from test_json where info -> '$.name' in ('foo', 'boo');
then return empty;
Suggested fix:
WHEN execute query:
select * from test_json where info -> '$.name' in ('foo', 'boo');
should return row 2;