Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL)
-
Tried on Ubuntu
Description
The JSON_TYPE works well with arguments generated by the JSON_QUERY funtions and correctly detect the OBJECT and ARRAY types.
When the argument originates from the JSON_VALUE function, it detects onyl INTEGERs correctly.
Decimals are detected as DOUBLE.
Strings are detected as NULL (no type) and strings beginning with an integer (like "23hjk") number are detected as INTEGER; if they begin with a decimal (like "3.234dfg") they are detected as DOUBLE.
SELECT
|
JSON_VALID(t.json),
|
JSON_TYPE(JSON_QUERY(t.json,'$.b')), |
JSON_TYPE(JSON_QUERY(t.json,'$.b.gh')), |
JSON_TYPE(JSON_VALUE(t.json,'$.b.ab')), |
JSON_TYPE(JSON_VALUE(t.json,'$.b.cd')), |
JSON_TYPE(JSON_VALUE(t.json,'$.b.ef')), |
JSON_TYPE(JSON_VALUE(t.json,'$.b.gh[0].ghi')), |
JSON_TYPE(JSON_VALUE(t.json,'$.b.gh[1].jkl')) |
FROM
|
(SELECT '{"a": "abc", "b": {"ab": "xyz5", "cd": "1xvz", "ef": "321", "gh": [{"ghi": "1.234"}, {"jkl": "334.2qrt"}]}}' AS json) AS t; |
Actually these statements would be sufficient to reproduce:
select JSON_TYPE('321'); |
show warnings;
|
|
select JSON_TYPE('abc'); |
show warnings;
|
|
select JSON_TYPE('123abc'); |
show warnings;
|
|
select JSON_TYPE('12.3abc'); |
show warnings;
|
Attachments
Issue Links
- includes
-
MDEV-19487 JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER"
- Closed