Bug #79316 json_search fail with integers
Submitted: 17 Nov 2015 16:30 Modified: 18 Nov 2015 8:26
Reporter: Stefano Giacone Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: JSON Severity:S2 (Serious)
Version:5.7.9 OS:Windows (win7)
Assigned to: CPU Architecture:Any
Tags: INTEGER, json, search

[17 Nov 2015 16:30] Stefano Giacone
Description:
json_search return NULL when searching for INTEGER even if the INTEGER is present inside the JSON

How to repeat:
mysql> select json_search('[1,2,3]','all','1');
+----------------------------------+
| json_search('[1,2,3]','all','1') |
+----------------------------------+
| NULL                             |
+----------------------------------+
1 row in set (0.00 sec)

The above query should have returned 

"$[0]"

as in this case:

mysql> select json_search('["1",2,3]','all','1');
+------------------------------------+
| json_search('["1",2,3]','all','1') |
+------------------------------------+
| "$[0]"                             |
+------------------------------------+
1 row in set (0.00 sec)
[18 Nov 2015 5:22] MySQL Verification Team
Hello Stefano,

Thank you for the report.
This is most likely duplicate of Bug #79233, pls see Bug #79233

Thanks,
Umesh
[18 Nov 2015 8:26] Stefano Giacone
I confirm: it's a duplicate. Sorry for that. (I swear I searched for similar bug, but I was not able to find it. I'll try to improve my search skills)