|
|
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.
|