diff options
Diffstat (limited to 'storage/spider/mysql-test/spider/bugfix')
13 files changed, 560 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc new file mode 100644 index 00000000000..1880a1c7bba --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc new file mode 100644 index 00000000000..63fd70a4b49 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc @@ -0,0 +1,43 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1 +let $MASTER_1_COMMENT_P_2_1= + PARTITION BY LIST(a % 3) ( + PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"', + PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"', + PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON + DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON + DROP TABLE IF EXISTS ta_r4; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE ta_r2 ( + a INT, + b VARCHAR(30), + PRIMARY KEY(a) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE ta_r3 ( + a INT, + b VARCHAR(30), + PRIMARY KEY(a) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE ta_r4 ( + a INT, + b VARCHAR(30), + PRIMARY KEY(a) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT a, b FROM ta_r2 ORDER BY a $STR_SEMICOLON + SELECT a, b FROM ta_r3 ORDER BY a $STR_SEMICOLON + SELECT a, b FROM ta_r4 ORDER BY a; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc new file mode 100644 index 00000000000..1880a1c7bba --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc new file mode 100644 index 00000000000..b5b77a53798 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc @@ -0,0 +1,43 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1 +let $MASTER_1_COMMENT_P_2_1= + PARTITION BY RANGE(i) ( + PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"', + PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"', + PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON + DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON + DROP TABLE IF EXISTS ta_r4; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE ta_r2 ( + i INT, + j JSON, + PRIMARY KEY(i) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE ta_r3 ( + i INT, + j JSON, + PRIMARY KEY(i) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE ta_r4 ( + i INT, + j JSON, + PRIMARY KEY(i) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT i, j FROM ta_r2 ORDER BY i $STR_SEMICOLON + SELECT i, j FROM ta_r3 ORDER BY i $STR_SEMICOLON + SELECT i, j FROM ta_r4 ORDER BY i; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result new file mode 100644 index 00000000000..164c68fbc0c --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result @@ -0,0 +1,97 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-24020 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +connection master_1; +CREATE TABLE tbl_a ( +a INT, +b VARCHAR(30), +PRIMARY KEY(a) +) ENGINE=Spider PARTITION BY LIST(a % 3) ( +PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"' + ) +INSERT INTO tbl_a VALUES(10000, " abcd "); +INSERT INTO tbl_a VALUES(10001, " abcd "); +INSERT INTO tbl_a VALUES(10002, " abcd "); +INSERT INTO tbl_a VALUES(10003, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10004, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10005, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10006, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10007, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10008, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]"); + +test 1 +connection master_1; +UPDATE tbl_a SET b = trim(b) WHERE a = 10000; +SELECT * FROM tbl_a WHERE a = 10000; +a b +10000 abcd +UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001; +SELECT * FROM tbl_a WHERE a = 10001; +a b +10001 abcd +UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002; +SELECT * FROM tbl_a WHERE a = 10002; +a b +10002 abcd +UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003; +SELECT * FROM tbl_a WHERE a = 10003; +a b +10003 abcd] +UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004; +SELECT * FROM tbl_a WHERE a = 10004; +a b +10004 abcd][[ +UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005; +SELECT * FROM tbl_a WHERE a = 10005; +a b +10005 [[[abcd] +UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006; +SELECT * FROM tbl_a WHERE a = 10006; +a b +10006 abcd +UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007; +SELECT * FROM tbl_a WHERE a = 10007; +a b +10007 [[[abcd]] +UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008; +SELECT * FROM tbl_a WHERE a = 10008; +a b +10008 abcd +UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009; +SELECT * FROM tbl_a WHERE a = 10009; +a b +10009 abcd + +deinit +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 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result new file mode 100644 index 00000000000..f084c967435 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result @@ -0,0 +1,78 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-24517 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=Spider PARTITION BY RANGE(i) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"' + ) +INSERT INTO tbl_a (i, j) VALUES +(1, '{"ID": "3", "Name": "Barney", "Age": 18}'), +(2, '{"ID": "4", "Name": "Betty", "Age": 19}'), +(3, '{"ID": "2", "Name": "Wilma", "Age": 20}'), +(4, '[10, 20, [30, 40]]'); + +test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Age')=19; +i j +2 {"ID": "4", "Name": "Betty", "Age": 19} +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Name')="Betty"; +i j +2 {"ID": "4", "Name": "Betty", "Age": 19} +SELECT i, JSON_EXTRACT(j, "$.ID") +FROM tbl_a +WHERE JSON_EXTRACT(j, "$.ID") > 1 AND i < 4 +ORDER BY JSON_EXTRACT(j, "$.Name"); +i JSON_EXTRACT(j, "$.ID") +1 "3" +2 "4" +3 "2" +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[1]') = 20; +i j +4 [10, 20, [30, 40]] +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[2][0]') = 30; +i j +4 [10, 20, [30, 40]] + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result new file mode 100644 index 00000000000..08481cd15f9 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result @@ -0,0 +1,49 @@ +# +# MDEV-24760 SELECT..CASE statement syntax error at Spider Engine 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; +DROP TABLE IF EXISTS tbl_a; +Warnings: +Note 1051 Unknown table 'auto_test_remote.tbl_a' +CREATE TABLE tbl_a ( +id int NOT NULL AUTO_INCREMENT, +name varchar(255) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO tbl_a (name) VALUES ('Alice'), ('Bob'); +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a ( +id int NOT NULL AUTO_INCREMENT, +name varchar(255) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' +PARTITION BY HASH(id) ( +PARTITION pt1 COMMENT='srv "s_2_1"' +); +SELECT id, CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END FROM tbl_a; +id CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END +1 A +2 B +SELECT id, CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END FROM tbl_a; +id CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END +1 A +2 B +DROP DATABASE auto_test_local; +connection child2_1; +DROP DATABASE 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_24020.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.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_24020.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test new file mode 100644 index 00000000000..ac06d86052b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test @@ -0,0 +1,90 @@ +--source ../include/mdev_24020_init.inc +--echo +--echo this test is for MDEV-24020 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +--disable_ps_protocol +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_ps_protocol +--enable_query_log + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT, + b VARCHAR(30), + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +eval CREATE TABLE tbl_a ( + a INT, + b VARCHAR(30), + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +--enable_query_log +INSERT INTO tbl_a VALUES(10000, " abcd "); +INSERT INTO tbl_a VALUES(10001, " abcd "); +INSERT INTO tbl_a VALUES(10002, " abcd "); +INSERT INTO tbl_a VALUES(10003, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10004, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10005, "[[[abcd][["); +INSERT INTO tbl_a VALUES(10006, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10007, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10008, "[[[abcd]]"); +INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]"); + +--echo +--echo test 1 + +--connection master_1 +UPDATE tbl_a SET b = trim(b) WHERE a = 10000; +SELECT * FROM tbl_a WHERE a = 10000; +UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001; +SELECT * FROM tbl_a WHERE a = 10001; +UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002; +SELECT * FROM tbl_a WHERE a = 10002; +UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003; +SELECT * FROM tbl_a WHERE a = 10003; +UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004; +SELECT * FROM tbl_a WHERE a = 10004; +UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005; +SELECT * FROM tbl_a WHERE a = 10005; +UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006; +SELECT * FROM tbl_a WHERE a = 10006; +UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007; +SELECT * FROM tbl_a WHERE a = 10007; +UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008; +SELECT * FROM tbl_a WHERE a = 10008; +UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009; +SELECT * FROM tbl_a WHERE a = 10009; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; + +--enable_warnings +--source ../include/mdev_24020_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.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_24517.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test new file mode 100644 index 00000000000..21b9dda4f12 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test @@ -0,0 +1,80 @@ +--source ../include/mdev_24517_init.inc +--echo +--echo this test is for MDEV-24517 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +--disable_ps_protocol +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_ps_protocol +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + i INT, + j JSON, + PRIMARY KEY(i) +) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +eval CREATE TABLE tbl_a ( + i INT, + j JSON, + PRIMARY KEY(i) +) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +--enable_query_log +INSERT INTO tbl_a (i, j) VALUES + (1, '{"ID": "3", "Name": "Barney", "Age": 18}'), + (2, '{"ID": "4", "Name": "Betty", "Age": 19}'), + (3, '{"ID": "2", "Name": "Wilma", "Age": 20}'), + (4, '[10, 20, [30, 40]]'); + +--echo +--echo test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Age')=19; +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Name')="Betty"; +SELECT i, JSON_EXTRACT(j, "$.ID") + FROM tbl_a + WHERE JSON_EXTRACT(j, "$.ID") > 1 AND i < 4 + ORDER BY JSON_EXTRACT(j, "$.Name"); +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[1]') = 20; +SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[2][0]') = 30; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/mdev_24517_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.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_24760.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test new file mode 100644 index 00000000000..149b057d003 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test @@ -0,0 +1,49 @@ +--echo # +--echo # MDEV-24760 SELECT..CASE statement syntax error at Spider Engine table +--echo # + +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_query_log +--enable_result_log + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +DROP TABLE IF EXISTS tbl_a; +eval CREATE TABLE tbl_a ( + id int NOT NULL AUTO_INCREMENT, + name varchar(255) DEFAULT NULL, + PRIMARY KEY (id) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +INSERT INTO tbl_a (name) VALUES ('Alice'), ('Bob'); + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; + +eval CREATE TABLE tbl_a ( + id int NOT NULL AUTO_INCREMENT, + name varchar(255) DEFAULT NULL, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' +PARTITION BY HASH(id) ( + PARTITION pt1 COMMENT='srv "s_2_1"' +); + +SELECT id, CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END FROM tbl_a; +SELECT id, CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END FROM tbl_a; + +DROP DATABASE auto_test_local; + +--connection child2_1 +DROP DATABASE auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_query_log +--enable_result_log |