diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 3b38d748b05..e9bee553542 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -581,5 +581,13 @@ show warnings; Level Code Message Error 4177 Can't store an array or an object in the scalar column 'a' of JSON_TABLE 't'. # +# MDEV-JSON_TABLE: CREATE TABLE ignores NULL ON ERROR (implicit or explicit) and fails. +# +CREATE TABLE t1 AS SELECT * FROM JSON_TABLE('{"x":1}', '$' COLUMNS(f DATE PATH '$.*')) AS jt; +SELECT * FROM t1; +f +NULL +DROP TABLE t1; +# # End of 10.6 tests # diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 7d7085c7e89..151d35e1424 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -453,6 +453,14 @@ drop table json_table; select a from json_table('[[]]', '$' columns(a char(8) path '$' error on error)) t; show warnings; +--echo # +--echo # MDEV-JSON_TABLE: CREATE TABLE ignores NULL ON ERROR (implicit or explicit) and fails. +--echo # +CREATE TABLE t1 AS SELECT * FROM JSON_TABLE('{"x":1}', '$' COLUMNS(f DATE PATH '$.*')) AS jt; +SELECT * FROM t1; +DROP TABLE t1; + + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/json_table.cc b/sql/json_table.cc index 157e9379a4c..95ca1aae3f5 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -325,6 +325,7 @@ int ha_json_table::fill_column_values(uchar * buf, uchar *pos) Json_table_column *jc; List_iterator_fast jc_i(m_jt->m_columns); my_ptrdiff_t ptrdiff= buf - table->record[0]; + Abort_on_warning_instant_set ao_set(table->in_use, FALSE); while ((jc= jc_i++)) {