Bug #94365 JSON_SEARCH do not search if JSON_ARRAY is a serch value
Submitted: 16 Feb 2019 10:50 Modified: 18 Mar 2019 15:22
Reporter: Anrii Pertsiukh Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[16 Feb 2019 10:50] Anrii Pertsiukh
Description:
The search_str search string argument of JSON_SEARCH can't process JSON_ARRAY

How to repeat:
SET @a=JSON_OBJECT('a', JSON_ARRAY(JSON_OBJECT('file', 'name1'), JSON_OBJECT('file', 'name2'), JSON_OBJECT('file', 'name3')));
SET @s=JSON_ARRAY('name2', 'name3');

SELECT JSON_SEARCH(@a, 'all', 'name3');
returns:
"$.a[2].file"

SELECT JSON_SEARCH(@a, 'all', @s);
returns: 
null

should return:
["$.a[1].file", "$.a[2].file"]

Suggested fix:
Allow to use JSON_ARRAY as search_str argument JSON_SEARCH
[18 Mar 2019 15:22] MySQL Verification Team
Hi,

Thank you for your report.

I find that your idea is very good.

Verified as a feature request.