[MDEV-32288] JSON_EXTRACT not respecting order of paths when returning results Created: 2023-09-29  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.4, 10.5, 10.6, 10.10, 10.11, 11.0, 11.1, 11.2
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Vicențiu Ciorbaru Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None


 Description   

+--------------------------------------------------------+
| JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][0]', '$[2][1]') |
+--------------------------------------------------------+
| [30, 40]                                               |
+--------------------------------------------------------+

MariaDB [(none)]> select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][0]');
+--------------------------------------------------------+
| JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][0]') |
+--------------------------------------------------------+
| [30, 40]                                               |
+--------------------------------------------------------+

The result should not be the same.

MySQL:

mysql> select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][0]');
+--------------------------------------------------------+
| JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][0]') |
+--------------------------------------------------------+
| [40, 30]                                               |
+--------------------------------------------------------+


Generated at Thu Feb 08 10:30:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.