mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-30704: JSON_SCHEMA_VALID: multipleOf must be greater than zero
Analysis: multipleOf must be strictly greater then 0. However the implementation only disallowed values strcitly less than 0 Fix: check if value is less than or equal to 0 instead of less than 0 and return true. Also fixed the incorrect return value for some other keywords.
This commit is contained in:
@ -3494,4 +3494,43 @@ SET @schema = '{
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30704: JSON_SCHEMA_VALID: multipleOf must be greater than zero
|
||||
--echo #
|
||||
|
||||
SET @schema = '{
|
||||
"multipleOf": 0
|
||||
}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "maxLength" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "minLength" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "maxProperties" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "minProperties" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "maxItems" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "minItems" : -3}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '2');
|
||||
|
||||
SET @schema= '{ "items" : ["str1"]}';
|
||||
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '[]');
|
||||
|
||||
|
||||
--echo # End of 11.1 test
|
||||
|
Reference in New Issue
Block a user