Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Row comparison IN subquery on a Spider table handled by the
# group by handler
#
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test', USER 'root');
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t1_s (a INT, b INT) ENGINE=SPIDER
WRAPPER=mariadb REMOTE_SERVER=srv REMOTE_TABLE=t1;
SELECT 1 WHERE (1,1) IN (SELECT a, b FROM t1_s);
1
1
SELECT 1 WHERE (2,2) IN (SELECT a, b FROM t1_s);
1
1
SELECT 1 WHERE (1,2) IN (SELECT a, b FROM t1_s);
1
DROP TABLE t1_s, t1;
DROP SERVER srv;
for master_1
for child2
for child3
32 changes: 32 additions & 0 deletions storage/spider/mysql-test/spider/bugfix/t/gbh_row_in_subquery.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--echo #
--echo # Row comparison IN subquery on a Spider table handled by the
--echo # group by handler
--echo #

--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log

set spider_same_server_link= 1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test', USER 'root');

CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t1_s (a INT, b INT) ENGINE=SPIDER
WRAPPER=mariadb REMOTE_SERVER=srv REMOTE_TABLE=t1;

SELECT 1 WHERE (1,1) IN (SELECT a, b FROM t1_s);
SELECT 1 WHERE (2,2) IN (SELECT a, b FROM t1_s);
SELECT 1 WHERE (1,2) IN (SELECT a, b FROM t1_s);

DROP TABLE t1_s, t1;
DROP SERVER srv;

--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
9 changes: 8 additions & 1 deletion storage/spider/spd_db_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7260,7 +7260,14 @@ int spider_db_open_item_field(
DBUG_RETURN(0);
} else {
DBUG_PRINT("info",("spider tmp_table=%u", field->table->s->tmp_table));
if (field->table->s->tmp_table != INTERNAL_TMP_TABLE)
/*
A field of a temporary table created by the optimizer, or of one
standing in for a normal table, belongs to no remote table, so it
is printed as a plain identifier below rather than looked up among
the spider tables.
*/
if (field->table->s->tmp_table != INTERNAL_TMP_TABLE &&
!field->table->s->is_optimizer_tmp_table())
{
if (!use_fields)
{
Expand Down
Loading