1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-19487: JSON_TYPE doesnt detect the type of String Values

(returns NULL) and for Date/DateTime returns "INTEGER"

Analysis:
When the first character of json is scanned it is number. Based on that
integer is returned.
Fix:
Scan rest of the json before returning the final result to ensure json is
valid in the first place in order to have a valid type.
This commit is contained in:
Rucha Deodhar
2024-03-19 01:30:13 +05:30
parent c6e3fe29d4
commit d7df63e1c9
4 changed files with 36 additions and 5 deletions

View File

@ -1125,6 +1125,13 @@ INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [
DROP TABLE t;
--echo #
--echo # MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER"
--echo #
SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date'));
--echo #
--echo # End of 10.5 tests
--echo #