|
| 1 | +--echo # |
| 2 | +--echo # MDEV-27172 Prefix indices on Spider tables may lead to wrong query results |
| 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 | +SET @general_log_backup = @@global.general_log; |
| 13 | +SET @log_output_backup = @@global.log_output; |
| 14 | +SET @@global.general_log = 1; |
| 15 | +SET @@global.log_output = "TABLE"; |
| 16 | + |
| 17 | +CREATE DATABASE auto_test_remote; |
| 18 | +USE auto_test_remote; |
| 19 | + |
| 20 | +eval CREATE TABLE tbl_a ( |
| 21 | + id int NOT NULL, |
| 22 | + greeting VARCHAR(255), |
| 23 | + KEY(greeting) |
| 24 | +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; |
| 25 | + |
| 26 | +eval CREATE TABLE tbl_b ( |
| 27 | + id int NOT NULL, |
| 28 | + greeting VARCHAR(255), |
| 29 | + KEY k (greeting(5)) |
| 30 | +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; |
| 31 | + |
| 32 | +eval CREATE TABLE tbl_c ( |
| 33 | + id int NOT NULL, |
| 34 | + greeting TEXT, |
| 35 | + KEY k (greeting(5)) |
| 36 | +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; |
| 37 | + |
| 38 | +TRUNCATE TABLE mysql.general_log; |
| 39 | + |
| 40 | +--connection master_1 |
| 41 | +CREATE DATABASE auto_test_local; |
| 42 | +USE auto_test_local; |
| 43 | + |
| 44 | +# = (equality) |
| 45 | +eval CREATE TABLE tbl_a ( |
| 46 | + id int NOT NULL, |
| 47 | + greeting VARCHAR(255), |
| 48 | + KEY k (greeting) |
| 49 | +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; |
| 50 | + |
| 51 | +INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!"); |
| 52 | +SELECT * FROM tbl_a WHERE greeting = "Aloha!" |
| 53 | + AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH |
| 54 | + |
| 55 | +# LIKE |
| 56 | +eval CREATE TABLE tbl_b ( |
| 57 | + id int NOT NULL, |
| 58 | + greeting VARCHAR(255), |
| 59 | + KEY k (greeting(5)) |
| 60 | +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b", srv "s_2_1"'; |
| 61 | + |
| 62 | +INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!"); |
| 63 | +SELECT * FROM tbl_b WHERE greeting = "Aloha!" |
| 64 | + AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH |
| 65 | + |
| 66 | +# LIKE |
| 67 | +eval CREATE TABLE tbl_c ( |
| 68 | + id int NOT NULL, |
| 69 | + greeting TEXT, |
| 70 | + KEY k (greeting(5)) |
| 71 | +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c", srv "s_2_1"'; |
| 72 | + |
| 73 | +INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!"); |
| 74 | +SELECT * FROM tbl_c WHERE greeting = "Aloha!" |
| 75 | + AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH |
| 76 | + |
| 77 | +--connection child2_1 |
| 78 | +SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'; |
| 79 | + |
| 80 | +--connection child2_1 |
| 81 | +SET @@global.general_log = @general_log_backup; |
| 82 | +SET @@global.log_output = @log_output_backup; |
| 83 | +DROP DATABASE auto_test_remote; |
| 84 | + |
| 85 | +--connection master_1 |
| 86 | +DROP DATABASE auto_test_local; |
| 87 | + |
| 88 | +--disable_query_log |
| 89 | +--disable_result_log |
| 90 | +--source ../../t/test_deinit.inc |
| 91 | +--enable_result_log |
| 92 | +--enable_query_log |
0 commit comments