~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/r/ndb_partition_range.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1;
 
2
CREATE TABLE t1 (
 
3
a int not null,
 
4
b int not null,
 
5
c int not null,
 
6
primary key(a,b),
 
7
index (a))
 
8
engine = ndb
 
9
partition by range (a)
 
10
partitions 3
 
11
(partition x1 values less than (5),
 
12
partition x2 values less than (10),
 
13
partition x3 values less than (20));
 
14
INSERT into t1 values (1, 1, 1);
 
15
INSERT into t1 values (6, 1, 1);
 
16
INSERT into t1 values (10, 1, 1);
 
17
INSERT into t1 values (15, 1, 1);
 
18
select * from information_schema.partitions where table_name= 't1';
 
19
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      PARTITION_NAME  SUBPARTITION_NAME       PARTITION_ORDINAL_POSITION      SUBPARTITION_ORDINAL_POSITION   PARTITION_METHOD        SUBPARTITION_METHOD     PARTITION_EXPRESSION    SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION   TABLE_ROWS      AVG_ROW_LENGTH  DATA_LENGTH     MAX_DATA_LENGTH INDEX_LENGTH    DATA_FREE       CREATE_TIME     UPDATE_TIME     CHECK_TIME      CHECKSUM        PARTITION_COMMENT       NODEGROUP       TABLESPACE_NAME
 
20
NULL    test    t1      x1      NULL    1       NULL    RANGE   NULL    a       NULL    5       0       0       0       #       0       0       #       #       NULL    NULL    default 0       default
 
21
NULL    test    t1      x2      NULL    2       NULL    RANGE   NULL    a       NULL    10      0       0       0       #       0       0       #       #       NULL    NULL    default 0       default
 
22
NULL    test    t1      x3      NULL    3       NULL    RANGE   NULL    a       NULL    20      0       0       0       #       0       0       #       #       NULL    NULL    default 0       default
 
23
select * from t1 order by a;
 
24
a       b       c
 
25
1       1       1
 
26
6       1       1
 
27
10      1       1
 
28
15      1       1
 
29
select * from t1 where a=1 order by a;
 
30
a       b       c
 
31
1       1       1
 
32
select * from t1 where a=15 and b=1 order by a;
 
33
a       b       c
 
34
15      1       1
 
35
select * from t1 where a=21 and b=1 order by a;
 
36
a       b       c
 
37
select * from t1 where a=21 order by a;
 
38
a       b       c
 
39
select * from t1 where a in (1,6,10,21) order by a;
 
40
a       b       c
 
41
1       1       1
 
42
6       1       1
 
43
10      1       1
 
44
select * from t1 where b=1 and a in (1,6,10,21) order by a;
 
45
a       b       c
 
46
1       1       1
 
47
6       1       1
 
48
10      1       1
 
49
drop table t1;
 
50
CREATE TABLE t1 (
 
51
a int not null,
 
52
b int not null,
 
53
c int not null,
 
54
primary key(b),
 
55
unique (a))
 
56
engine = ndb
 
57
partition by range (b)
 
58
partitions 3
 
59
(partition x1 values less than (5),
 
60
partition x2 values less than (10),
 
61
partition x3 values less than (20));
 
62
INSERT into t1 values (1, 1, 1);
 
63
INSERT into t1 values (2, 6, 1);
 
64
INSERT into t1 values (3, 10, 1);
 
65
INSERT into t1 values (4, 15, 1);
 
66
select * from t1 order by a;
 
67
a       b       c
 
68
1       1       1
 
69
2       6       1
 
70
3       10      1
 
71
4       15      1
 
72
UPDATE t1 set a = 5 WHERE b = 15;
 
73
select * from t1 order by a;
 
74
a       b       c
 
75
1       1       1
 
76
2       6       1
 
77
3       10      1
 
78
5       15      1
 
79
UPDATE t1 set a = 6 WHERE a = 5;
 
80
select * from t1 order by a;
 
81
a       b       c
 
82
1       1       1
 
83
2       6       1
 
84
3       10      1
 
85
6       15      1
 
86
select * from t1 where b=1 order by b;
 
87
a       b       c
 
88
1       1       1
 
89
select * from t1 where b=15 and a=1 order by b;
 
90
a       b       c
 
91
select * from t1 where b=21 and a=1 order by b;
 
92
a       b       c
 
93
select * from t1 where b=21 order by b;
 
94
a       b       c
 
95
select * from t1 where b in (1,6,10,21) order by b;
 
96
a       b       c
 
97
1       1       1
 
98
2       6       1
 
99
3       10      1
 
100
select * from t1 where a in (1,2,5,6) order by b;
 
101
a       b       c
 
102
1       1       1
 
103
2       6       1
 
104
6       15      1
 
105
select * from t1 where a=1 and b in (1,6,10,21) order by b;
 
106
a       b       c
 
107
1       1       1
 
108
DELETE from t1 WHERE b = 6;
 
109
DELETE from t1 WHERE a = 6;
 
110
show create table t1;
 
111
Table   Create Table
 
112
t1      CREATE TABLE `t1` (
 
113
  `a` int(11) NOT NULL,
 
114
  `b` int(11) NOT NULL,
 
115
  `c` int(11) NOT NULL,
 
116
  PRIMARY KEY (`b`),
 
117
  UNIQUE KEY `a` (`a`)
 
118
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (10) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (20) ENGINE = ndbcluster)
 
119
drop table t1;
 
120
CREATE TABLE t1
 
121
(id MEDIUMINT NOT NULL,
 
122
b1 BIT(8),
 
123
vc VARCHAR(255),
 
124
bc CHAR(255),
 
125
d DECIMAL(10,4) DEFAULT 0,
 
126
f FLOAT DEFAULT 0,
 
127
total BIGINT UNSIGNED,
 
128
y YEAR,
 
129
t DATE) ENGINE=NDB
 
130
PARTITION BY RANGE (YEAR(t))
 
131
(PARTITION p0 VALUES LESS THAN (1901),
 
132
PARTITION p1 VALUES LESS THAN (1946),
 
133
PARTITION p2 VALUES LESS THAN (1966),
 
134
PARTITION p3 VALUES LESS THAN (1986),
 
135
PARTITION p4 VALUES LESS THAN (2005),
 
136
PARTITION p5 VALUES LESS THAN MAXVALUE);
 
137
INSERT INTO t1 VALUES (0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 
138
SELECT * FROM t1;
 
139
id      b1      vc      bc      d       f       total   y       t
 
140
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
141
ALTER TABLE t1 ENGINE=MYISAM;
 
142
SELECT * FROM t1;
 
143
id      b1      vc      bc      d       f       total   y       t
 
144
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
145
DROP TABLE t1;
 
146
CREATE LOGFILE GROUP lg1
 
147
ADD UNDOFILE 'undofile.dat'
 
148
  INITIAL_SIZE 16M
 
149
UNDO_BUFFER_SIZE=1M
 
150
ENGINE=NDB;
 
151
CREATE TABLESPACE ts1
 
152
ADD DATAFILE 'datafile.dat'
 
153
  USE LOGFILE GROUP lg1
 
154
INITIAL_SIZE 12M
 
155
ENGINE NDB;
 
156
CREATE TABLE test.t1 (
 
157
a1 INT,
 
158
a2 TEXT NOT NULL,
 
159
a3 BIT NOT NULL,
 
160
a4 DECIMAL(8,3),
 
161
a5 INT NOT NULL,
 
162
a6 INT,
 
163
PRIMARY KEY(a1))
 
164
TABLESPACE ts1 STORAGE DISK ENGINE=NDB
 
165
PARTITION BY LIST (a1)
 
166
(PARTITION p0 VALUES IN (1,2,3,4,5),
 
167
PARTITION p1 VALUES IN (6,7,8,9, 10),
 
168
PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
 
169
ALTER TABLE test.t1 DROP COLUMN a6;
 
170
ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
 
171
SELECT COUNT(*) FROM test.t1;
 
172
COUNT(*)
 
173
15
 
174
ALTER TABLE test.t1 DROP COLUMN a4;
 
175
SELECT COUNT(*) FROM test.t1;
 
176
COUNT(*)
 
177
15
 
178
DROP TABLE t1;
 
179
CREATE TABLE test.t1 (
 
180
a1 INT,
 
181
a2 TEXT NOT NULL,
 
182
a3 BIT NOT NULL,
 
183
a4 DECIMAL(8,3),
 
184
a5 INT NOT NULL,
 
185
a6 VARCHAR(255),
 
186
PRIMARY KEY(a1))
 
187
TABLESPACE ts1 STORAGE DISK ENGINE=NDB
 
188
PARTITION BY HASH(a1)
 
189
PARTITIONS 4;
 
190
SELECT COUNT(*) FROM test.t1;
 
191
COUNT(*)
 
192
15
 
193
ALTER TABLE test.t1 DROP COLUMN a4;
 
194
SELECT COUNT(*) FROM test.t1;
 
195
COUNT(*)
 
196
15
 
197
DROP TABLE t1;
 
198
ALTER TABLESPACE ts1 
 
199
DROP DATAFILE 'datafile.dat' 
 
200
ENGINE=NDB;
 
201
DROP TABLESPACE ts1 ENGINE=NDB;
 
202
DROP LOGFILE GROUP lg1 ENGINE=NDB;
 
203
CREATE TABLE t1
 
204
(id MEDIUMINT NOT NULL,
 
205
b1 BIT(8),
 
206
vc VARCHAR(255),
 
207
bc CHAR(255),
 
208
d DECIMAL(10,4) DEFAULT 0,
 
209
f FLOAT DEFAULT 0,
 
210
total BIGINT UNSIGNED,
 
211
y YEAR,
 
212
t DATE) ENGINE=NDB
 
213
PARTITION BY LIST(id)
 
214
(PARTITION p0 VALUES IN (2, 4),
 
215
PARTITION p1 VALUES IN (42, 142));
 
216
INSERT INTO t1 VALUES (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 
217
SELECT * FROM t1;
 
218
id      b1      vc      bc      d       f       total   y       t
 
219
2       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
220
ALTER TABLE t1 ADD PARTITION
 
221
(PARTITION p2 VALUES IN (412));
 
222
SELECT * FROM t1;
 
223
id      b1      vc      bc      d       f       total   y       t
 
224
2       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
225
DROP TABLE t1;
 
226
CREATE TABLE t1 (
 
227
a int not null,
 
228
b int not null,
 
229
c int not null)
 
230
partition by list(a)
 
231
partitions 2
 
232
(partition x123 values in (1,5,6),
 
233
partition x234 values in (4,7,8));
 
234
INSERT into t1 VALUES (5,1,1);
 
235
select * from t1;
 
236
a       b       c
 
237
5       1       1
 
238
UPDATE t1 SET a=8 WHERE a=5 AND b=1;
 
239
select * from t1;
 
240
a       b       c
 
241
8       1       1
 
242
drop table t1;
 
243
CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
 
244
PARTITION BY RANGE(f1)
 
245
( PARTITION part1 VALUES LESS THAN (2),
 
246
PARTITION part2 VALUES LESS THAN (1000));
 
247
INSERT INTO t1 VALUES(1, '---1---');
 
248
INSERT INTO t1 VALUES(2, '---2---');
 
249
select * from t1 order by f1;
 
250
f1      f2
 
251
1       ---1---
 
252
2       ---2---
 
253
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
 
254
select * from t1 order by f1;
 
255
f1      f2
 
256
1       ---1---
 
257
6       ---2---
 
258
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
 
259
select * from t1 order by f1;
 
260
f1      f2
 
261
5       ---1---
 
262
6       ---2---
 
263
drop table t1;