diff options
author | Yuchen Pei <yuchen.pei@mariadb.com> | 2022-12-20 10:38:35 +1100 |
---|---|---|
committer | Yuchen Pei <yuchen.pei@mariadb.com> | 2022-12-22 12:49:04 +1100 |
commit | fb41117c907a99d051ac09c229762978373d7eb0 (patch) | |
tree | fb2caf16455ba315c5e38fc40adbd99b9bb40595 | |
parent | c21566a78a0fbdd6c1634f82aa9baa61a9c98388 (diff) | |
download | mariadb-git-fb41117c907a99d051ac09c229762978373d7eb0.tar.gz |
MDEV-29653 Make sure Item_cache_row has the correct type handler.
The incorrect type handler caused an incorrect result_type() for
Item_cache_row (STRING_RESULT rather than ROW_RESULT). By updating the
constructor of Item_cache_row with the correct type handler, it fixes
this problem.
Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Sergei Golubchik <serg@mariadb.com>
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result | 33 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf | 3 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test | 37 |
4 files changed, 74 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h index 083bc2261ce..9389250d6ec 100644 --- a/sql/item.h +++ b/sql/item.h @@ -7305,7 +7305,7 @@ class Item_cache_row: public Item_cache bool save_array; public: Item_cache_row(THD *thd): - Item_cache(thd), values(0), item_count(2), + Item_cache(thd, &type_handler_row), values(0), item_count(2), save_array(0) {} /* diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result new file mode 100644 index 00000000000..abbcfcb74cc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result @@ -0,0 +1,33 @@ +# +# MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table +# +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +CREATE TABLE t ( +c INT +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE ts ( +c INT +) ENGINE=Spider COMMENT='table "t", srv "s_2_1"'; +SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1)); +1 +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test new file mode 100644 index 00000000000..6accaed38fe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test @@ -0,0 +1,37 @@ +--echo # +--echo # MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +eval CREATE TABLE t ( + c INT +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; +eval CREATE TABLE ts ( + c INT +) $MASTER_1_ENGINE COMMENT='table "t", srv "s_2_1"'; + +SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1)); + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_query_log +--enable_result_log |