diff options
| author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2022-03-01 16:14:36 +0530 |
|---|---|---|
| committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2022-04-13 21:16:32 +0530 |
| commit | abe971219456b1f41923c06ff715fd4efeb02850 (patch) | |
| tree | 1661de489d87f8c6bbde19c4188bfe3906f02a62 /mysql-test/main/func_json.test | |
| parent | dfcbb30a92c2f1d33ceefb56a1d3fa13f8d0ce67 (diff) | |
| download | mariadb-git-abe971219456b1f41923c06ff715fd4efeb02850.tar.gz | |
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.
Diffstat (limited to 'mysql-test/main/func_json.test')
| -rw-r--r-- | mysql-test/main/func_json.test | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index ea7358f4563..34a4b30b0ab 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1307,5 +1307,15 @@ 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 # |
