[MDEV-20293] SQL/JSON path: array wildcard accessor (.[*]) doesn't wrap Created: 2019-08-08  Updated: 2022-06-01

Status: Open
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.4.7
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Markus Winand Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In SQL/JSON Path lax mode (default), the array accessor [...] as well as the wildcard array accessor [*] wrap non-array values (SQL-2:2016 9.39 General Rule 11 g 3 A and 4 A).

MariaDB only wraps for the regular array accessor:

MariaDB 5.5.5-10.4.7-MariaDB> select json_value('{"a": 1}', '$.a[0]');
+----------------------------------+
| json_value('{"a": 1}', '$.a[0]') |
+----------------------------------+
| 1                                |
+----------------------------------+
1 row in set (0.00 sec)
 
MariaDB 5.5.5-10.4.7-MariaDB> select json_value('{"a": 1}', '$.a[*]');
+----------------------------------+
| json_value('{"a": 1}', '$.a[*]') |
+----------------------------------+
| NULL                             |
+----------------------------------+
1 row in set (0.00 sec)


Generated at Thu Feb 08 08:58:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.