| 1 |
create table t1( |
| 2 |
c1 int not null primary key, |
| 3 |
c2 int not null, |
| 4 |
c3 int not null, |
| 5 |
c4 int not null, |
| 6 |
c5 int not null, |
| 7 |
c6 int not null, |
| 8 |
c7 int not null, |
| 9 |
c8 int not null, |
| 10 |
c9 int not null, |
| 11 |
c10 int not null, |
| 12 |
c11 int not null, |
| 13 |
c12 int not null, |
| 14 |
c13 int not null, |
| 15 |
c14 int not null, |
| 16 |
c15 int not null, |
| 17 |
c16 int not null, |
| 18 |
c17 int not null, |
| 19 |
c18 int not null, |
| 20 |
c19 int not null, |
| 21 |
c20 int not null, |
| 22 |
c21 int not null, |
| 23 |
c22 int not null, |
| 24 |
c23 int not null, |
| 25 |
c24 int not null, |
| 26 |
c25 int not null, |
| 27 |
c26 int not null, |
| 28 |
c27 int not null, |
| 29 |
c28 int not null, |
| 30 |
c29 int not null, |
| 31 |
c30 int not null, |
| 32 |
c31 int not null, |
| 33 |
c32 int not null, |
| 34 |
unique key uk2(c2), |
| 35 |
unique key uk3(c3), |
| 36 |
unique key uk4(c4), |
| 37 |
unique key uk5(c5), |
| 38 |
unique key uk6(c6), |
| 39 |
unique key uk7(c7), |
| 40 |
unique key uk8(c8), |
| 41 |
unique key uk9(c9), |
| 42 |
unique key uk10(c10), |
| 43 |
unique key uk11(c11), |
| 44 |
unique key uk12(c12), |
| 45 |
unique key uk13(c13), |
| 46 |
unique key uk14(c14), |
| 47 |
unique key uk15(c15), |
| 48 |
unique key uk16(c16), |
| 49 |
unique key uk17(c17), |
| 50 |
unique key uk18(c18), |
| 51 |
unique key uk19(c19), |
| 52 |
unique key uk20(c20), |
| 53 |
unique key uk21(c21), |
| 54 |
unique key uk22(c22), |
| 55 |
unique key uk23(c23), |
| 56 |
unique key uk24(c24) |
| 57 |
) engine=ndbcluster; |
| 58 |
update t1 set c2=3000+c2, c3=3000+c3, c4=3000+c4, |
| 59 |
c5=3000+c5, c6=3000+c6, c7=3000+c7, c8=3000+c8, |
| 60 |
c9=3000+c9, c10=3000+c10, c11=3000+c11, c12=3000+c12, |
| 61 |
c13=3000+c13, c14=3000+c14, c15=3000+c15, c16=3000+c16, |
| 62 |
c17=3000+c17, c18=3000+c18, c19=3000+c19, c20=3000+c20, |
| 63 |
c21=3000+c21, c22=3000+c22, c23=3000+c23, c24=3000+c24, |
| 64 |
c25=3000+c25, c26=3000+c26, c27=3000+c27, c28=3000+c28, |
| 65 |
c29=3000+c29, c30=3000+c30, c31=3000+c31, c32=3000+c32; |
| 66 |
show warnings; |
| 67 |
Level Code Message |
| 68 |
update t1 set c2=3000+c2, c3=3000+c3, c4=3000+c4, |
| 69 |
c5=3000+c5, c6=3000+c6, c7=3000+c7, c8=3000+c8, |
| 70 |
c9=3000+c9, c10=3000+c10, c11=3000+c11, c12=3000+c12, |
| 71 |
c13=3000+c13, c14=3000+c14, c15=3000+c15, c16=3000+c16, |
| 72 |
c17=3000+c17, c18=3000+c18, c19=3000+c19, c20=3000+c20, |
| 73 |
c21=3000+c21, c22=3000+c22, c23=3000+c23, c24=3000+c24, |
| 74 |
c25=3000+c25, c26=3000+c26, c27=3000+c27, c28=3000+c28, |
| 75 |
c29=3000+c29, c30=3000+c30, c31=3000+c31, c32=3000+c32 |
| 76 |
where c1 < 500; |
| 77 |
delete from t1; |
| 78 |
delete from t1 where c1 < 100; |
| 79 |
drop table t1; |
| 80 |
create table parent( |
| 81 |
c1 int not null primary key, |
| 82 |
c2 int not null, |
| 83 |
c3 int not null, |
| 84 |
c4 int not null, |
| 85 |
c5 int not null, |
| 86 |
unique key uk2(c2), |
| 87 |
unique key uk3(c3), |
| 88 |
unique key uk4(c4), |
| 89 |
unique key uk5(c5) |
| 90 |
) engine=ndbcluster; |
| 91 |
create table child( |
| 92 |
c1 int not null primary key, |
| 93 |
c2 int not null, |
| 94 |
c3 int not null, |
| 95 |
c4 int, |
| 96 |
c5 int, |
| 97 |
unique key uk2(c2), |
| 98 |
unique key uk3(c3), |
| 99 |
key k4(c4), |
| 100 |
key k5(c5), |
| 101 |
foreign key fk2(c2) references parent(c1) on update restrict on delete cascade, |
| 102 |
foreign key fk3(c3) references parent(c1) on update restrict on delete cascade |
| 103 |
) comment='NDB_TABLE=FULLY_REPLICATED=1' engine=ndbcluster; |
| 104 |
create table grandchild( |
| 105 |
c1 int not null primary key, |
| 106 |
c2 int, |
| 107 |
c3 int, |
| 108 |
c4 int, |
| 109 |
c5 int not null, |
| 110 |
unique key uk2(c2), |
| 111 |
unique key uk3(c3), |
| 112 |
key k4(c4), |
| 113 |
key k5(c5), |
| 114 |
foreign key fk4(c2) references child(c2) on update restrict on delete cascade, |
| 115 |
foreign key fk5(c3) references child(c3) on update restrict on delete cascade |
| 116 |
) engine=ndbcluster; |
| 117 |
set ndb_deferred_constraints = 0; |
| 118 |
update parent set c2=3000+c2, c3=3000+c3, |
| 119 |
c4=3000+c4, c5=3000+c5 |
| 120 |
where c1 < 1500; |
| 121 |
select * from parent where c1=1; |
| 122 |
c1 c2 c3 c4 c5 |
| 123 |
1 3001 3001 3001 3001 |
| 124 |
select * from child where c1=1; |
| 125 |
c1 c2 c3 c4 c5 |
| 126 |
1 1 1 1 1 |
| 127 |
begin; |
| 128 |
delete from parent; |
| 129 |
rollback; |
| 130 |
select count(*) from parent; |
| 131 |
count(*) |
| 132 |
3000 |
| 133 |
select count(*) from child; |
| 134 |
count(*) |
| 135 |
3000 |
| 136 |
select count(*) from grandchild; |
| 137 |
count(*) |
| 138 |
3000 |
| 139 |
delete from parent where c1<1500; |
| 140 |
delete from parent where c1<3001; |
| 141 |
select count(*) from parent; |
| 142 |
count(*) |
| 143 |
0 |
| 144 |
select count(*) from child; |
| 145 |
count(*) |
| 146 |
0 |
| 147 |
select count(*) from grandchild; |
| 148 |
count(*) |
| 149 |
0 |
| 150 |
drop table grandchild; |
| 151 |
drop table child; |
| 152 |
drop table parent; |