Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.9(EOL)
Description
Test:
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]');
|
Expected result:
Expected that 'last' and 'last-0' give the same result
SELECT JSON_VALUE(@json,'$.x[last]');
|
JSON_VALUE(@json,'$.x[last]')
|
1
|
SELECT JSON_VALUE(@json,'$.x[last-0]');
|
JSON_VALUE(@json,'$.x[last-0]')
|
1
|
and index '0' and '-0' too:
SELECT JSON_VALUE(@json,'$.x[-0]');
|
JSON_VALUE(@json,'$.x[-0]')
|
0
|
SELECT JSON_VALUE(@json,'$.x[0]');
|
JSON_VALUE(@json,'$.x[0]')
|
0
|
but Actual result:
SET @json='{ "x": [0,1]}';
|
SELECT JSON_VALUE(@json,'$.x[last]');
|
JSON_VALUE(@json,'$.x[last]')
|
1
|
SELECT JSON_VALUE(@json,'$.x[last-0]');
|
JSON_VALUE(@json,'$.x[last-0]')
|
NULL
|
SELECT JSON_VALUE(@json,'$.x[-0]');
|
JSON_VALUE(@json,'$.x[-0]')
|
NULL
|
SELECT JSON_VALUE(@json,'$.x[0]');
|
JSON_VALUE(@json,'$.x[0]')
|
0
|
Attachments
Issue Links
- relates to
-
MDEV-22224 Support JSON Path negative index
- Closed