stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int primary key,
b varchar(100) default 'b',
c varchar(100)) engine=ndbcluster;
insert into t1 values (1, 'b1', 'c1');
insert into t1 (a) values (2);
insert into t1 (a, b) values (3, 'b3');
replace into t1 values (5, 'b5', 'c5');
replace into t1 (a) values (6);
replace into t1 (a, c) values (7, 'c7');
select * from t1 order by a;
a	b	c
1	b1	c1
2	b	NULL
3	b3	NULL
5	b5	c5
6	b	NULL
7	b	c7
select * from t1 order by a;
a	b	c
1	b1	c1
2	b	NULL
3	b3	NULL
5	b5	c5
6	b	NULL
7	b	c7
replace into t1 (a) values (1);
replace into t1 (a, b) values (2, 'b2x');
replace into t1 (a, c) values (3, 'c3x');
replace into t1 (a, b, c) values (5, 'b5x', 'c5x');
replace into t1 (a) values (6);
replace into t1 (a) values (7);
select * from t1 order by a;
a	b	c
1	b	NULL
2	b2x	NULL
3	b	c3x
5	b5x	c5x
6	b	NULL
7	b	NULL
select * from t1 order by a;
a	b	c
1	b	NULL
2	b2x	NULL
3	b	c3x
5	b5x	c5x
6	b	NULL
7	b	NULL
drop table t1;
create table t1 (a int primary key,
b varchar(100) default 'b',
c varchar(100),
d text,
e text) engine=ndbcluster;
insert into t1 values (1, 'b1', 'c1', 'd1', 'e1');
insert into t1 (a) values (2);
insert into t1 (a, b, d) values (3, 'b3', 'd3');
replace into t1 values (5, 'b5', 'c5', 'd5', 'e5');
replace into t1 (a) values (6);
replace into t1 (a, c, e) values (7, 'c7', 'e7');
select * from t1 order by a;
a	b	c	d	e
1	b1	c1	d1	e1
2	b	NULL	NULL	NULL
3	b3	NULL	d3	NULL
5	b5	c5	d5	e5
6	b	NULL	NULL	NULL
7	b	c7	NULL	e7
select * from t1 order by a;
a	b	c	d	e
1	b1	c1	d1	e1
2	b	NULL	NULL	NULL
3	b3	NULL	d3	NULL
5	b5	c5	d5	e5
6	b	NULL	NULL	NULL
7	b	c7	NULL	e7
replace into t1 (a) values (1);
replace into t1 (a, b, d) values (2, 'b2x', 'd2x');
replace into t1 (a, c, e) values (3, 'c3x', 'e3x');
replace into t1 (a, b, c, d, e) values (5, 'b5x', 'c5x', 'd5x', 'e5x');
replace into t1 (a) values (6);
replace into t1 (a, e) values (7, 'e7x');
select * from t1 order by a;
a	b	c	d	e
1	b	NULL	NULL	NULL
2	b2x	NULL	d2x	NULL
3	b	c3x	NULL	e3x
5	b5x	c5x	d5x	e5x
6	b	NULL	NULL	NULL
7	b	NULL	NULL	e7x
select * from t1 order by a;
a	b	c	d	e
1	b	NULL	NULL	NULL
2	b2x	NULL	d2x	NULL
3	b	c3x	NULL	e3x
5	b5x	c5x	d5x	e5x
6	b	NULL	NULL	NULL
7	b	NULL	NULL	e7x
drop table t1;
