1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-27972: Unexpected behavior with negative zero (-0) in

JSON Path

Analysis: When we have '-' followed by 0, then the state is
changed to JE_SYN, meaning syntax error.
Fix: Change the state to PS_INT instead, because we are
reading '0' next (integer) and it is not a syntax error.
This commit is contained in:
Rucha Deodhar
2022-03-01 16:14:36 +05:30
parent dfcbb30a92
commit abe9712194
3 changed files with 27 additions and 1 deletions

View File

@ -1306,6 +1306,16 @@ SET @json='{
SELECT JSON_VALUE(@json, '$.A[-2][-2].key1');
SELECT JSON_VALUE(@json, '$.A[last-1][last-1].key1');
--echo #
--echo # MDEV-27972: Unexpected behavior with negative zero (-0) in JSON Path
--echo #
SET @json='{ "x": [0,1]}';
SELECT JSON_VALUE(@json,'$.x[last]');
SELECT JSON_VALUE(@json,'$.x[last-0]');
SELECT JSON_VALUE(@json,'$.x[-0]');
SELECT JSON_VALUE(@json,'$.x[0]');
--echo #
--echo # End of 10.9 Test
--echo #