1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-27990: Incorrect behavior of JSON_OVERLAPS() on warning

Analysis: In case of error while processing json document, we goto
error label which eventually return 1 instead of 0.
Fix: Return 0 in case of error instead of 1.
This commit is contained in:
Rucha Deodhar
2022-03-03 14:40:55 +05:30
parent a653dde279
commit 12abe61af4
3 changed files with 8 additions and 2 deletions

View File

@ -1742,9 +1742,14 @@ SELECT JSON_OVERLAPS('[1,2,{"A":B}]');
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_OVERLAPS' ERROR 42000: Incorrect parameter count in the call to native function 'JSON_OVERLAPS'
SELECT JSON_OVERLAPS('',''); SELECT JSON_OVERLAPS('','');
JSON_OVERLAPS('','') JSON_OVERLAPS('','')
1 0
Warnings: Warnings:
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_overlaps' Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_overlaps'
SELECT JSON_OVERLAPS('true','tr');
JSON_OVERLAPS('true','tr')
0
Warnings:
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_overlaps'
# #
# End of 10.9 test # End of 10.9 test
# #

View File

@ -1084,6 +1084,7 @@ SELECT JSON_OVERLAPS('[1,2,{"A":B}]', '{"A":B}', '{"C":"string1"}');
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_OVERLAPS('[1,2,{"A":B}]'); SELECT JSON_OVERLAPS('[1,2,{"A":B}]');
SELECT JSON_OVERLAPS('',''); SELECT JSON_OVERLAPS('','');
SELECT JSON_OVERLAPS('true','tr');
--echo # --echo #
--echo # End of 10.9 test --echo # End of 10.9 test

View File

@ -4387,7 +4387,7 @@ error:
report_json_error(js, &je, 0); report_json_error(js, &je, 0);
if (ve.s.error) if (ve.s.error)
report_json_error(val, &ve, 1); report_json_error(val, &ve, 1);
return 1; return 0;
} }
bool Item_func_json_overlaps::fix_length_and_dec() bool Item_func_json_overlaps::fix_length_and_dec()