Skip to content

Commit fb41117

Browse files
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>
1 parent c21566a commit fb41117

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

sql/item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7305,7 +7305,7 @@ class Item_cache_row: public Item_cache
73057305
bool save_array;
73067306
public:
73077307
Item_cache_row(THD *thd):
7308-
Item_cache(thd), values(0), item_count(2),
7308+
Item_cache(thd, &type_handler_row), values(0), item_count(2),
73097309
save_array(0) {}
73107310

73117311
/*
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table
3+
#
4+
for master_1
5+
for child2
6+
child2_1
7+
child2_2
8+
child2_3
9+
for child3
10+
connection child2_1;
11+
CREATE DATABASE auto_test_remote;
12+
USE auto_test_remote;
13+
CREATE TABLE t (
14+
c INT
15+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16+
connection master_1;
17+
CREATE DATABASE auto_test_local;
18+
USE auto_test_local;
19+
CREATE TABLE ts (
20+
c INT
21+
) ENGINE=Spider COMMENT='table "t", srv "s_2_1"';
22+
SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
23+
1
24+
connection master_1;
25+
DROP DATABASE IF EXISTS auto_test_local;
26+
connection child2_1;
27+
DROP DATABASE IF EXISTS auto_test_remote;
28+
for master_1
29+
for child2
30+
child2_1
31+
child2_2
32+
child2_3
33+
for child3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
!include include/default_mysqld.cnf
2+
!include ../my_1_1.cnf
3+
!include ../my_2_1.cnf
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--echo #
2+
--echo # MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table
3+
--echo #
4+
5+
--disable_query_log
6+
--disable_result_log
7+
--source ../../t/test_init.inc
8+
--enable_result_log
9+
--enable_query_log
10+
11+
--connection child2_1
12+
CREATE DATABASE auto_test_remote;
13+
USE auto_test_remote;
14+
eval CREATE TABLE t (
15+
c INT
16+
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
17+
18+
--connection master_1
19+
CREATE DATABASE auto_test_local;
20+
USE auto_test_local;
21+
eval CREATE TABLE ts (
22+
c INT
23+
) $MASTER_1_ENGINE COMMENT='table "t", srv "s_2_1"';
24+
25+
SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
26+
27+
--connection master_1
28+
DROP DATABASE IF EXISTS auto_test_local;
29+
30+
--connection child2_1
31+
DROP DATABASE IF EXISTS auto_test_remote;
32+
33+
--disable_query_log
34+
--disable_result_log
35+
--source ../t/test_deinit.inc
36+
--enable_query_log
37+
--enable_result_log

0 commit comments

Comments
 (0)