summaryrefslogtreecommitdiff
path: root/storage/vp/mysql-test/vp/spider/r/basic_sql_part.result
blob: 4c8648024eade66c0786a08834eeff43e6eda1b5 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3

drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
connection child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;

test select 1
connection master_1;
SELECT 1;
1
1
connection master_1;
DROP TABLE IF EXISTS tb_l;
CREATE TABLE tb_l (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE2 MASTER_1_CHARSET2
INSERT INTO tb_l (a, b, c) VALUES
(1, 'f', '2008-07-01 10:21:39'),
(2, 'g', '2000-02-01 00:00:00'),
(3, 'j', '2007-05-04 20:03:11'),
(4, 'i', '2003-10-30 05:01:03'),
(5, 'h', '2001-10-31 23:59:59');

create table with partition and select test
connection master_1;
CREATE TABLE ta_l2 (
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
SELECT a, b, c FROM tb_l
ERROR HY000: 'auto_test_local.ta_l2' is not of type 'BASE TABLE'
connection master_1;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
1	f	2008-07-01 10:21:39
2	g	2000-02-01 00:00:00
3	j	2007-05-04 20:03:11
4	i	2003-10-30 05:01:03
5	h	2001-10-31 23:59:59

select partition using pushdown
connection master_1;
SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
a.b = 'g' ORDER BY a.a;
a	b	date_format(a.c, '%Y-%m-%d %H:%i:%s')
2	g	2000-02-01 00:00:00

select partition using index pushdown
connection master_1;
SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
a.a > 0 AND a.b = 'g' ORDER BY a.a;
a	b	date_format(a.c, '%Y-%m-%d %H:%i:%s')
2	g	2000-02-01 00:00:00

update partition pushdown
connection master_1;
UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
connection master_1;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
1	f	2008-07-01 10:21:39
2	g	2000-02-01 00:00:00
3	e	2009-03-03 03:03:03
4	i	2003-10-30 05:01:03
5	h	2001-10-31 23:59:59

update partition index pushdown
connection master_1;
UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
connection master_1;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
1	f	2008-07-01 10:21:39
2	g	2000-02-01 00:00:00
3	j	2009-03-03 03:03:03
4	i	2003-10-30 05:01:03
5	h	2001-10-31 23:59:59

delete partition pushdown
TRUNCATE TABLE ta_l2;
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
connection master_1;
DELETE FROM ta_l2 WHERE b = 'g';
connection master_1;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
1	f	2008-07-01 10:21:39
3	j	2007-05-04 20:03:11
4	i	2003-10-30 05:01:03
5	h	2001-10-31 23:59:59

delete partition index pushdown
TRUNCATE TABLE ta_l2;
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
connection master_1;
DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
connection master_1;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
1	f	2008-07-01 10:21:39
3	j	2007-05-04 20:03:11
4	i	2003-10-30 05:01:03
5	h	2001-10-31 23:59:59

deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
connection child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3

end of test