summaryrefslogtreecommitdiff
path: root/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result
blob: d4c8c7e8ec29446eb2a08c8549e869baec5a7ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
#
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection child2_1;
SET @general_log_backup = @@global.general_log;
SET @log_output_backup = @@global.log_output;
SET @@global.general_log = 1;
SET @@global.log_output = "TABLE";
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE tbl_a (
id int NOT NULL,
greeting  VARCHAR(255),
KEY(greeting)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE tbl_b (
id int NOT NULL,
greeting VARCHAR(255),
KEY k (greeting(5))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE tbl_c (
id int NOT NULL,
greeting TEXT,
KEY k (greeting(5))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
TRUNCATE TABLE mysql.general_log;
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (
id int NOT NULL,
greeting VARCHAR(255),
KEY k (greeting)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
SELECT * FROM tbl_a WHERE greeting = "Aloha!"
  AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
id	greeting
2	Aloha!
CREATE TABLE tbl_b (
id int NOT NULL,
greeting VARCHAR(255),
KEY k (greeting(5))
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"';
INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
SELECT * FROM tbl_b WHERE greeting = "Aloha!"
  AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
id	greeting
2	Aloha!
CREATE TABLE tbl_c (
id int NOT NULL,
greeting TEXT,
KEY k (greeting(5))
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c", srv "s_2_1"';
INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
SELECT * FROM tbl_c WHERE greeting = "Aloha!"
  AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
id	greeting
2	Aloha!
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %';
argument
select `id`,`greeting` from `auto_test_remote`.`tbl_a` where `greeting` = 'Aloha!' and ((`greeting` = 'Aloha!'))
select `id`,`greeting` from `auto_test_remote`.`tbl_b` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
select `id`,`greeting` from `auto_test_remote`.`tbl_c` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'
connection child2_1;
SET @@global.general_log = @general_log_backup;
SET @@global.log_output = @log_output_backup;
DROP DATABASE auto_test_remote;
connection master_1;
DROP DATABASE auto_test_local;
for master_1
for child2
child2_1
child2_2
child2_3
for child3