⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 refactions2.out

📁 derby database source code.good for you.
💻 OUT
📖 第 1 页 / 共 5 页
字号:
ij> --Unsupported cases for referential actions , some of these are not supported currently in db2 udb also.--SQL0632N--FOREIGN KEY "<name>" is not valid because the table cannot be defined as a dependent of --table "<table-name>" because of del--ete rule restrictions (reason code = "<reason-code>").  --Explanation: A referential constraint cannot be defined because the object table of the CREATE TABLE or --ALTER TABLE statement cannot be defined as a dependent of table "<table-name>" for one of the following reason codes: --(01) The relationship is self-referencing and a self-referencing relationship already exists-- with the SET NULL delete rule. --(02) The relationship forms a cycle of two or more tables that cause the table to be delete-connected --to itself (all other delete rules in the cycle would be CASCADE). --(03) The relationship causes the table to be delete-connected to the indicated table through --multiple relationships and the delete rule of the existing relationship is SET NULL. --The delete rules of the existing relationships cause an error, not the delete rule specified in --the FOREIGN KEY clause of the CREATE TABLE or ALTER TABLE statement. --sqlcode: -632 -- sqlstate: 42915 -- case sql0632-01create table t1(a int not null primary key , b int references t1(a) ON DELETE SET NULL,                 c int references t1(a) ON DELETE CASCADE);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The table cannot be defined as a dependent of table APP.T1 because of delete rule restrictions. (The relationship is self-referencing and a self-referencing relationship already exists with the SET NULL delete rule.) '. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE SET NULL,                   z int references tself(b) ON DELETE SET NULL);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The table cannot be defined as a dependent of table APP.TSELF because of delete rule restrictions. (The relationship is self-referencing and a self-referencing relationship already exists with the SET NULL delete rule.) '. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE SET NULL,                   z int references tself(b) ON DELETE CASCADE);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The table cannot be defined as a dependent of table APP.TSELF because of delete rule restrictions. (The relationship is self-referencing and a self-referencing relationship already exists with the SET NULL delete rule.) '. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE SET NULL,                   z int references tself(b) ON DELETE RESTRICT);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The table cannot be defined as a dependent of table APP.TSELF because of delete rule restrictions. (The relationship is self-referencing and a self-referencing relationship already exists with the SET NULL delete rule.) '. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE SET NULL,                   z int references tself(b) ON DELETE NO ACTION);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The table cannot be defined as a dependent of table APP.TSELF because of delete rule restrictions. (The relationship is self-referencing and a self-referencing relationship already exists with the SET NULL delete rule.) '. ij> -- case sql0632 -02 (c2 fails)create table t1(a int not null primary key, b int not null unique);0 rows inserted/updated/deletedij> create table t2(x int not null primary key, y int);0 rows inserted/updated/deletedij> alter table t1 add constraint c1 foreign key (b)                             references t2(x) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (y)                              references t1(b) on delete set null;ERROR 42915: Foreign  Key 'C2' is invalid because 'The table cannot be defined as a dependent of table APP.T1 because of delete rule restrictions. (The relationship forms a cycle of two or more tables that cause the table to be delete-connected to itself (all other delete rules in the cycle would be CASCADE)).  '. ij> drop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij> -- constraint c4 failscreate table t1( a int not null primary key, b int);0 rows inserted/updated/deletedij> create table t2(x int, y int not null unique);0 rows inserted/updated/deletedij> create table t3(l int, m int not null unique , k int );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 t1 add constraint c2 foreign key (b)                              references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (m)                              references t2(y) on delete cascade;0 rows inserted/updated/deletedij> alter table t3 add constraint c4 foreign key (k)                              references t2(y) on delete set null;ERROR 42915: Foreign  Key 'C4' is invalid because 'the delete rule of foreign key  must be CASCADE. (The relationship would cause the table to be delete-connected to the same table through multiple relationships and such relationships must have the same delete rule (NO ACTION, RESTRICT or CASCADE).) '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t1 drop constraint c2;0 rows inserted/updated/deletedij> alter table t3 drop constraint c3;0 rows inserted/updated/deletedij> drop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij> drop table t3;0 rows inserted/updated/deletedij> create table t1( a int not null primary key, b int);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> create table t5(c1 int not null unique , c2 int);0 rows inserted/updated/deletedij> create table t6(c1 int not null unique , c2 int);0 rows inserted/updated/deletedij> --delete connected cycle--different path from t2alter table t2 add constraint c3 foreign key (z)                              references t4(c1) on delete cascade;0 rows inserted/updated/deletedij> alter table t4 add constraint c4 foreign key (c2)                              references t5(c1) on delete cascade;0 rows inserted/updated/deletedij> alter table t5 add constraint c5 foreign key (c2)                              references t6(c1) on delete cascade;0 rows inserted/updated/deletedij> --cycle forming alter -- c6 should failalter table t1 add constraint c1 foreign key (b)                              references t3(m) on delete cascade;0 rows inserted/updated/deletedij> alter table t2 add constraint c2 foreign key (x)                             references t1(a) on delete cascade;0 rows inserted/updated/deletedij> alter table t3 add constraint c6 foreign key (k)                              references t2(y) on delete SET NULL;ERROR 42915: Foreign  Key 'C6' is invalid because 'The table cannot be defined as a dependent of table APP.T2 because of delete rule restrictions. (The relationship forms a cycle of two or more tables that cause the table to be delete-connected to itself (all other delete rules in the cycle would be CASCADE)).  '. ij> alter table t1 drop constraint c1;0 rows inserted/updated/deletedij> alter table t2 drop constraint c2;0 rows inserted/updated/deletedij> alter table t2 drop constraint c3;0 rows inserted/updated/deletedij> alter table t4 drop constraint c4;0 rows inserted/updated/deletedij> alter table t5 drop constraint c5;0 rows inserted/updated/deletedij> drop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij> drop table t3;0 rows inserted/updated/deletedij> drop table t4;0 rows inserted/updated/deletedij> drop table t5;0 rows inserted/updated/deletedij> drop table t6;0 rows inserted/updated/deletedij> -- case sql0632 - 3 (c2 fails) create table t1( a int not null primary key);0 rows inserted/updated/deletedij> create table t2(x int, y int not null unique);0 rows inserted/updated/deletedij> create table t3(l int, m int );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 t3 add constraint c2 foreign key (l)                               references t1(a) on delete set null;0 rows inserted/updated/deletedij> alter table t3 add constraint c3 foreign key (m)                               references t2(y) on delete set null;ERROR 42915: Foreign  Key 'C3' is invalid because 'The table cannot be defined as a dependent of table APP.T2 because of delete rule restrictions. (The relationship causes the table to be delete-connected to the indicated table through multiple relationships and the delete rule of the existing relationship is SET NULL.).  '. ij> alter table t2 drop constraint c1;0 rows inserted/updated/deletedij> alter table t3 drop constraint c2;0 rows inserted/updated/deletedij> drop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij> drop table t3;0 rows inserted/updated/deletedij> --SQL0633N The delete rule of FOREIGN KEY "<name>" must be "<delete-rule>" (reason code = "<reason-code>").  --Explanation: The delete rule specified in a FOREIGN KEY clause of the CREATE TABLE or ALTER TABLE --statement is not valid. The indicated delete rule is required for one of the following reason codes: --(01) The referential constraint is self-referencing and an existing self-referencing constraint has the-- indicated delete rule (NO ACTION, RESTRICT or CASCADE). --(02) The referential constraint is self-referencing and the table is dependent in a relationship with-- a delete rule of CASCADE. --(03) The relationship would cause the table to be delete-connected to the same table through multiple --relationships and such relationships must have the same delete rule (NO ACTION, RESTRICT or CASCADE). -- case sql0633-01 (t1 creation should fail)create table t1(a int not null primary key , b int references t1(a) ON DELETE CASCADE,                 c int references t1(a) ON DELETE SET NULL);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be CASCADE. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE RESTRICT,                   z int references tself(b) ON DELETE CASCADE);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be RESTRICT. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE RESTRICT,                   z int references tself(b) ON DELETE NO ACTION);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be RESTRICT. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE RESTRICT,                   z int references tself(b) ON DELETE SET NULL);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be RESTRICT. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE NO ACTION,                   z int references tself(b) ON DELETE CASCADE);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be NO ACTION. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE NO ACTION,                   z int references tself(b) ON DELETE RESTRICT);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be NO ACTION. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE NO ACTION,                   z int references tself(b) ON DELETE SET NULL);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be NO ACTION. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE CASCADE,                   z int references tself(b) ON DELETE SET NULL);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be CASCADE. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE CASCADE,                   z int references tself(b) ON DELETE NO ACTION);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be CASCADE. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE CASCADE,                   z int references tself(b) ON DELETE RESTRICT);ERROR 42915: Foreign  Key 'xxxxGENERATED-IDxxxx' is invalid because 'The delete rule of foreign key must be CASCADE. (The referential constraint is self-referencing and an existing self-referencing constraint has the indicated delete rule (NO ACTION, RESTRICT or CASCADE).)'. ij> --FOLLOWING CASES SHOULD PASScreate table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE NO ACTION,                   z int references tself(b) ON DELETE NO ACTION);0 rows inserted/updated/deletedij> drop table tself;0 rows inserted/updated/deletedij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE CASCADE,                   z int references tself(b) ON DELETE CASCADE);0 rows inserted/updated/deletedij> drop table tself;0 rows inserted/updated/deletedij> create table tself( a int not null primary key, b int not null  unique,                  x int references tself(a) ON DELETE RESTRICT,                   z int references tself(b) ON DELETE RESTRICT);0 rows inserted/updated/deletedij> drop table tself;0 rows inserted/updated/deletedij> -- END PASS CASES

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -