📄 refactions2.out
字号:
0 rows inserted/updated/deletedij> create table t2(x int, y int not null unique, z int);0 rows inserted/updated/deletedij> create table t3(l int, m int not null unique , k int );0 rows inserted/updated/deletedij> create table t4(c1 int not null unique , c2 int);0 rows inserted/updated/deletedij> -- error scenario 1: adding constraint c4 will make t2 get two paths from t1 with SET NULLSalter table t2 add constraint c1 foreign key (x) references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete cascade;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;ERROR 42915: Foreign Key 'C4' is invalid because 'the delete rule of foreign key can not be CASCADE. (The relationship would cause another table to be delete-connected to the same table through multiple paths with different delete rules or with delete rule equal to SET NULL.) '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> -- error scenario 2: adding constraint c4 will make t2 get two paths from t1 with a SET NULL and--- a CASCADE.alter table t2 add constraint c1 foreign key (x) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete cascade;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;ERROR 42915: Foreign Key 'C4' is invalid because 'the delete rule of foreign key can not be CASCADE. (The relationship would cause another table to be delete-connected to the same table through multiple paths with different delete rules or with delete rule equal to SET NULL.) '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> -- error scenario 3: adding constraint c4 will make t2 get two paths from t1 with a NO ACTION --- and a CASCADE.alter table t2 add constraint c1 foreign key (x) references t1(a) on delete NO ACTION;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete cascade;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;ERROR 42915: Foreign Key 'C4' is invalid because 'the delete rule of foreign key can not be CASCADE. (The relationship would cause another table to be delete-connected to the same table through multiple paths with different delete rules or with delete rule equal to SET NULL.) '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> -- error scenario 4: adding constraint c4 will make t2 get two paths from t1 with a CASCADE--- and a RESTRICT.alter table t2 add constraint c1 foreign key (x) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete RESTRICT;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete cascade;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;ERROR 42915: Foreign Key 'C4' is invalid because 'the delete rule of foreign key can not be CASCADE. (The relationship would cause another table to be delete-connected to the same table through multiple paths with different delete rules or with delete rule equal to SET NULL.) '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> --FOLLOWING SHOULD PASSalter table t2 add constraint c1 foreign key (x) references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete RESTRICT;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete RESTRICT;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t2 add constraint c1 foreign key (x) references t1(a) on delete SET NULL;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (z) references t4(c1) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (l) references t1(a) on delete CASCADE;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c1) references t3(m) on delete RESTRICT;0 rows inserted/updated/deletedij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> drop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij> drop table t3;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -