summaryrefslogtreecommitdiff
path: root/mysql-test/suite/json/t
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2021-04-15 11:52:22 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2021-04-21 10:21:48 +0400
commit41e368f22db02e5c907aa40ae8c5c8e34ded3db9 (patch)
treeb009fff0aaa1f8fcc76bf04a25366dbc0111832f /mysql-test/suite/json/t
parent0a09525625b2f234e7adc07ad37f74cff4a0f4e2 (diff)
downloadmariadb-git-41e368f22db02e5c907aa40ae8c5c8e34ded3db9.tar.gz
MDEV-25149 JSON_TABLE: Inconsistency in implicit data type conversion.
Only return the error if field->store produced errors, not warnings.
Diffstat (limited to 'mysql-test/suite/json/t')
-rw-r--r--mysql-test/suite/json/t/json_table.test17
-rw-r--r--mysql-test/suite/json/t/json_table_mysql.test6
2 files changed, 20 insertions, 3 deletions
diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test
index b8b16a750d1..f250fcbf58a 100644
--- a/mysql-test/suite/json/t/json_table.test
+++ b/mysql-test/suite/json/t/json_table.test
@@ -798,5 +798,22 @@ 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 #
diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test
index eebc4ba11ee..aaf123c6f7c 100644
--- a/mysql-test/suite/json/t/json_table_mysql.test
+++ b/mysql-test/suite/json/t/json_table_mysql.test
@@ -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)