Bug #79233 | JSON_SEARCH does not search for non-string values | ||
---|---|---|---|
Submitted: | 11 Nov 2015 14:42 | Modified: | 17 Nov 2015 18:11 |
Reporter: | Georgi Kodinov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
Version: | 5.7+ | OS: | Any |
Assigned to: | Jon Stephens | CPU Architecture: | Any |
[11 Nov 2015 14:42]
Georgi Kodinov
[11 Nov 2015 15:41]
MySQL Verification Team
Thank you for the bug report. mysql 5.7 > SELECT JSON_SEARCH( '{"a": "1", "b": "2" }', 'one', 2); +-------------------------------------------------+ | JSON_SEARCH( '{"a": "1", "b": "2" }', 'one', 2) | +-------------------------------------------------+ | "$.b" | +-------------------------------------------------+ 1 row in set (0.02 sec) mysql 5.7 > SELECT JSON_SEARCH( '{"a": "1", "b": 2 }', 'one', 2); +-----------------------------------------------+ | JSON_SEARCH( '{"a": "1", "b": 2 }', 'one', 2) | +-----------------------------------------------+ | NULL | +-----------------------------------------------+ 1 row in set (0.00 sec)
[13 Nov 2015 9:26]
Knut Anders Hatlen
Changing category to documentation. The specification at https://dev.mysql.com/worklog/task/?id=7909 says: "This function returns path(s) to the given string. The returned path(s) identify object members or array slots which are character strings." So it seems that the intention of this function was to search for strings. The documentation should be updated to clarify that the function is for searching for string scalars, not for scalars in general.
[17 Nov 2015 18:11]
Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.
[18 Nov 2015 5:23]
MySQL Verification Team
Bug #79316 marked as duplicate of this
[15 Mar 2018 9:34]
Georgi Kodinov
Filed a feature request for the need here: Bug #90085