1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-25149 JSON_TABLE: Inconsistency in implicit data type conversion.

Only return the error if field->store produced errors, not warnings.
This commit is contained in:
Alexey Botchkov
2021-04-15 11:52:22 +04:00
parent 0a09525625
commit 41e368f22d
5 changed files with 146 additions and 33 deletions

View File

@@ -797,6 +797,23 @@ SELECT * FROM JSON_TABLE (CONVERT('[1,2]' USING koi8u), '$[*]' COLUMNS(a CHAR(8)
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
--echo #
--echo # MDEV-25149 JSON_TABLE: Inconsistency in implicit data type conversion.
--echo #
select * from json_table( '[{"a":"asd"}, {"a":123}, {"a":[]}, {"a":{}} ]', '$[*]'
columns ( id for ordinality,
intcol int path '$.a' default '1234' on empty default '5678' on error)
) as tt;
--echo #
--echo # MDEV-25377 JSON_TABLE: Wrong value with implicit conversion.
--echo #
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt;
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by converted;
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -327,7 +327,7 @@ SELECT * FROM v;
SHOW CREATE VIEW v;
DROP VIEW v;
--error ER_JSON_TABLE_SCALAR_EXPECTED
#--error ER_JSON_TABLE_SCALAR_EXPECTED
SELECT * FROM JSON_TABLE('"asdf"',
'$' COLUMNS (a INT PATH '$' ERROR ON ERROR)) AS jt;
--error ER_JSON_TABLE_MULTIPLE_MATCHES
@@ -339,7 +339,7 @@ SELECT * FROM
SELECT * FROM
JSON_TABLE('[{"a":1},{"a":2}]',
'$' COLUMNS (a JSON PATH '$[*].a' ERROR ON ERROR)) AS jt;
--error ER_JSON_TABLE_SCALAR_EXPECTED
#--error ER_JSON_TABLE_SCALAR_EXPECTED
SELECT * FROM
JSON_TABLE('123.456', '$' COLUMNS (a DECIMAL(2,1) PATH '$' ERROR ON ERROR)) AS jt;
SELECT * FROM
@@ -729,7 +729,7 @@ SELECT * FROM
) AS alias2;
#--error ER_JT_VALUE_OUT_OF_RANGE
--error ER_JSON_TABLE_SCALAR_EXPECTED
# --error ER_JSON_TABLE_SCALAR_EXPECTED
SELECT * FROM
JSON_TABLE('[3.14159]',
'$[*]' COLUMNS (col18 DECIMAL(3,3) PATH '$' ERROR ON ERROR)