1SET DEFAULT_STORAGE_ENGINE='tokudb';
2*** Bug #22169 ***
3DROP TABLE IF EXISTS t1;
4CREATE TABLE t1 (a int, b bigint, c char(10), d date, e int, primary key (a));
5INSERT into t1 values (1,54,"zardosht", '1986-08-30', 3287);
6INSERT into t1 values (2,8709,"Alaadin", '1789-01-31', 8327);
7INSERT into t1 values (3,234,"Gilbert", '1325-05-21', 871233);
8INSERT into t1 values (4,563,"Lois", '1981-11-06', 654);
9INSERT into t1 values (5,587,"Lexington", '1844-03-01', 75);
10INSERT into t1 values (6,934764,"Goliath", '1161-11-01', 453);
11INSERT into t1 values (7,109234,"Peter", '2005-11-01', 5);
12INSERT into t1 values (8,9438,"Bart", '1472-11-01', 234);
13INSERT into t1 values (9,111111111,"Superman", '1776-07-04', 65);
14INSERT into t1 values (10,50000004,"Batman", '1981-11-01', 87423);
15SELECT * from t1;
16a	b	c	d	e
171	54	zardosht	1986-08-30	3287
182	8709	Alaadin	1789-01-31	8327
193	234	Gilbert	1325-05-21	871233
204	563	Lois	1981-11-06	654
215	587	Lexington	1844-03-01	75
226	934764	Goliath	1161-11-01	453
237	109234	Peter	2005-11-01	5
248	9438	Bart	1472-11-01	234
259	111111111	Superman	1776-07-04	65
2610	50000004	Batman	1981-11-01	87423
27alter table t1 drop primary key;
28SELECT * from t1;
29a	b	c	d	e
301	54	zardosht	1986-08-30	3287
312	8709	Alaadin	1789-01-31	8327
323	234	Gilbert	1325-05-21	871233
334	563	Lois	1981-11-06	654
345	587	Lexington	1844-03-01	75
356	934764	Goliath	1161-11-01	453
367	109234	Peter	2005-11-01	5
378	9438	Bart	1472-11-01	234
389	111111111	Superman	1776-07-04	65
3910	50000004	Batman	1981-11-01	87423
40alter table t1 add primary key (c(3));
41SELECT * from t1;
42a	b	c	d	e
432	8709	Alaadin	1789-01-31	8327
448	9438	Bart	1472-11-01	234
4510	50000004	Batman	1981-11-01	87423
463	234	Gilbert	1325-05-21	871233
476	934764	Goliath	1161-11-01	453
485	587	Lexington	1844-03-01	75
494	563	Lois	1981-11-06	654
507	109234	Peter	2005-11-01	5
519	111111111	Superman	1776-07-04	65
521	54	zardosht	1986-08-30	3287
53alter table t1 drop primary key;
54SELECT * from t1;
55a	b	c	d	e
562	8709	Alaadin	1789-01-31	8327
578	9438	Bart	1472-11-01	234
5810	50000004	Batman	1981-11-01	87423
593	234	Gilbert	1325-05-21	871233
606	934764	Goliath	1161-11-01	453
615	587	Lexington	1844-03-01	75
624	563	Lois	1981-11-06	654
637	109234	Peter	2005-11-01	5
649	111111111	Superman	1776-07-04	65
651	54	zardosht	1986-08-30	3287
66alter table t1 add primary key (a,c(3));
67SELECT * from t1;
68a	b	c	d	e
691	54	zardosht	1986-08-30	3287
702	8709	Alaadin	1789-01-31	8327
713	234	Gilbert	1325-05-21	871233
724	563	Lois	1981-11-06	654
735	587	Lexington	1844-03-01	75
746	934764	Goliath	1161-11-01	453
757	109234	Peter	2005-11-01	5
768	9438	Bart	1472-11-01	234
779	111111111	Superman	1776-07-04	65
7810	50000004	Batman	1981-11-01	87423
79alter table t1 drop primary key;
80SELECT * from t1;
81a	b	c	d	e
821	54	zardosht	1986-08-30	3287
832	8709	Alaadin	1789-01-31	8327
843	234	Gilbert	1325-05-21	871233
854	563	Lois	1981-11-06	654
865	587	Lexington	1844-03-01	75
876	934764	Goliath	1161-11-01	453
887	109234	Peter	2005-11-01	5
898	9438	Bart	1472-11-01	234
909	111111111	Superman	1776-07-04	65
9110	50000004	Batman	1981-11-01	87423
92alter table t1 add primary key (c(3),a);
93SELECT * from t1;
94a	b	c	d	e
952	8709	Alaadin	1789-01-31	8327
968	9438	Bart	1472-11-01	234
9710	50000004	Batman	1981-11-01	87423
983	234	Gilbert	1325-05-21	871233
996	934764	Goliath	1161-11-01	453
1005	587	Lexington	1844-03-01	75
1014	563	Lois	1981-11-06	654
1027	109234	Peter	2005-11-01	5
1039	111111111	Superman	1776-07-04	65
1041	54	zardosht	1986-08-30	3287
105alter table t1 drop primary key;
106SELECT * from t1;
107a	b	c	d	e
1082	8709	Alaadin	1789-01-31	8327
1098	9438	Bart	1472-11-01	234
11010	50000004	Batman	1981-11-01	87423
1113	234	Gilbert	1325-05-21	871233
1126	934764	Goliath	1161-11-01	453
1135	587	Lexington	1844-03-01	75
1144	563	Lois	1981-11-06	654
1157	109234	Peter	2005-11-01	5
1169	111111111	Superman	1776-07-04	65
1171	54	zardosht	1986-08-30	3287
118alter table t1 add primary key (c(3),e);
119SELECT * from t1;
120a	b	c	d	e
1212	8709	Alaadin	1789-01-31	8327
1228	9438	Bart	1472-11-01	234
12310	50000004	Batman	1981-11-01	87423
1243	234	Gilbert	1325-05-21	871233
1256	934764	Goliath	1161-11-01	453
1265	587	Lexington	1844-03-01	75
1274	563	Lois	1981-11-06	654
1287	109234	Peter	2005-11-01	5
1299	111111111	Superman	1776-07-04	65
1301	54	zardosht	1986-08-30	3287
131alter table t1 drop primary key;
132SELECT * from t1;
133a	b	c	d	e
1342	8709	Alaadin	1789-01-31	8327
1358	9438	Bart	1472-11-01	234
13610	50000004	Batman	1981-11-01	87423
1373	234	Gilbert	1325-05-21	871233
1386	934764	Goliath	1161-11-01	453
1395	587	Lexington	1844-03-01	75
1404	563	Lois	1981-11-06	654
1417	109234	Peter	2005-11-01	5
1429	111111111	Superman	1776-07-04	65
1431	54	zardosht	1986-08-30	3287
144alter table t1 add primary key (e,c(3));
145SELECT * from t1;
146a	b	c	d	e
1477	109234	Peter	2005-11-01	5
1489	111111111	Superman	1776-07-04	65
1495	587	Lexington	1844-03-01	75
1508	9438	Bart	1472-11-01	234
1516	934764	Goliath	1161-11-01	453
1524	563	Lois	1981-11-06	654
1531	54	zardosht	1986-08-30	3287
1542	8709	Alaadin	1789-01-31	8327
15510	50000004	Batman	1981-11-01	87423
1563	234	Gilbert	1325-05-21	871233
157DROP TABLE t1;
158