[MDEV-12324] Wrong result (phantom array value) on JSON_EXTRACT Created: 2017-03-22  Updated: 2017-08-10  Resolved: 2017-08-07

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2
Fix Version/s: 10.2.8

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

MariaDB 10.2

MariaDB [test]> SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
+-------------------------------------------+
| JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' ) |
+-------------------------------------------+
| ["bar"]                                   |
+-------------------------------------------+
1 row in set (0.00 sec)

I think it is incorrect and there should be NULL, since $[*] is supposed to represent array values, but there is no array in the JSON text.
It's also inconsistent with this result:

MariaDB 10.2

MariaDB [test]> SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
+-----------------------------------------+
| JSON_EXTRACT( '{"foo":"bar"}', '$[*]' ) |
+-----------------------------------------+
| NULL                                    |
+-----------------------------------------+
1 row in set (0.00 sec)

MySQL returns NULL for both queries, however in this case I don't want to use it as a baseline, because its behavior with these pseudo-arrays is even more inconsistent. Please just use documentation, standards and common sense to determine what the correct result should be.



 Comments   
Comment by Alexey Botchkov [ 2017-08-07 ]

http://lists.askmonty.org/pipermail/commits/2017-August/011354.html

Generated at Thu Feb 08 07:56:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.