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

📄 renametable.out

📁 derby database source code.good for you.
💻 OUT
字号:
ij> -- rename table tests-- create some database objectscreate table t1(c11 int not null primary key);0 rows inserted/updated/deletedij> create table t2(c21 int not null primary key);0 rows inserted/updated/deletedij> create table t3(c31 int not null primary key);0 rows inserted/updated/deletedij> create table t4(c41 int not null primary key);0 rows inserted/updated/deletedij> -- create table with foreign key constraintcreate table t5 (c51 int, constraint fk foreign key(c51) references t4);0 rows inserted/updated/deletedij> create view v1 as select * from t1;0 rows inserted/updated/deletedij> -- bug 5685create index i1_t3 on t3(c31);0 rows inserted/updated/deletedWARNING 01504: The new index is a duplicate of an existing index: xxxxGENERATED-IDxxxx.ij> -- do some populationinsert into t1 values 11;1 row inserted/updated/deletedij> insert into t2 values 21;1 row inserted/updated/deletedij> insert into t2 values 22;1 row inserted/updated/deletedij> insert into t3 values 31;1 row inserted/updated/deletedij> insert into t3 values 32;1 row inserted/updated/deletedij> insert into t3 values 33;1 row inserted/updated/deletedij> autocommit off;ij> -- negative tests-- rename a non-existing tablerename table notexists to notexists1;ERROR 42Y55: 'RENAME TABLE' cannot be performed on 'NOTEXISTS' because it does not exist.ij> -- the new table name for rename already existsrename table t1 to t2;ERROR X0Y32: Table/View 'T2' already exists in Schema 'APP'.ij> -- rename a system tablerename table sys.systables to fake;ERROR 42X62: 'RENAME TABLE' is not allowed in the 'SYS' schema.ij> -- rename a viewrename table v1 to fake;ERROR 42Y62: 'RENAME TABLE' is not allowed on 'APP.V1' because it is a view.ij> -- cannot rename a table when there is an open cursor on itget cursor c1 as 'select * from t2';ij> rename table t2 to fake;ERROR X0X95: Operation 'RENAME' cannot be performed on object 'T2' because there is an open ResultSet dependent on that object.ij> close c1;ij> -- cannot rename a table when there is a view on itrename table t1 to fake;ERROR X0Y23: Operation 'RENAME' cannot be performed on object 'T1' because VIEW 'V1' is dependent on that object.ij> -- cannot rename because t5's foreign key depends on t4rename table t4 to fake;ERROR X0Y25: Operation 'RENAME' cannot be performed on object 'xxxxGENERATED-IDxxxx' because CONSTRAINT 'FK' is dependent on that object.ij> -- only dropping the fk constraint can allow the table to be renamedalter table t5 drop constraint fk;0 rows inserted/updated/deletedij> -- this statement should not failrename table t4 to realTab;0 rows inserted/updated/deletedij> -- positive testsselect * from t3;C31        -----------31         32         33         ij> -- can rename a table when there is an index defined on itrename table t3 to t3r;0 rows inserted/updated/deletedij> select * from t3r;C31        -----------31         32         33         ij> -- creating a prepared statement on a tableautocommit off;ij> prepare p3 as 'select * from t3r where c31 > ?';ij> execute p3 using 'values (30)';C31        -----------31         32         33         ij> -- can rename with no errorsrename table t3r to t3;0 rows inserted/updated/deletedij> -- but the execute statement will failexecute p3 using 'values (30)';ERROR 42X05: Table 'T3R' does not exist.ij> remove p3;ij> autocommit on;ij> -- creating a table with triggers defined on itcreate table t6 (c61 int default 1);0 rows inserted/updated/deletedij> create table t7(c71 int);0 rows inserted/updated/deletedij> -- bug 5684create trigger t7insert after insert on t7 referencing new as NEWROW for each row mode db2sql insert into t6 values(NEWROW.c71);0 rows inserted/updated/deletedij> insert into t7 values(1);1 row inserted/updated/deletedij> -- bug 5683. Should failrename table t7 to t7r;ERROR X0Y25: Operation 'RENAME' cannot be performed on object 'T7' because TRIGGER 'T7INSERT' is dependent on that object.ij> select * from t7r;ERROR 42X05: Table 'T7R' does not exist.ij> select * from t7;C71        -----------1          ij> rename table t6 to t6r;0 rows inserted/updated/deletedij> insert into t7 values(3);ERROR 42X05: Table 'T6' does not exist.ij> select * from t6r;C61        -----------1          ij> select * from t7r;ERROR 42X05: Table 'T7R' does not exist.ij> -- Rename should fail if there is a check constraintcreate table tcheck (i int check(i>5));0 rows inserted/updated/deletedij> rename table tcheck to tcheck1;ERROR X0Y25: Operation 'RENAME' cannot be performed on object 'TCHECK' because CONSTRAINT 'xxxxGENERATED-IDxxxx' is dependent on that object.ij> drop table tcheck;0 rows inserted/updated/deletedij> -- Rename should pass after dropping the check constriantcreate table tcheck (i int, j int, constraint tcon check (i+j>2));0 rows inserted/updated/deletedij> rename table tcheck to tcheck1;ERROR X0Y25: Operation 'RENAME' cannot be performed on object 'TCHECK' because CONSTRAINT 'TCON' is dependent on that object.ij> alter table tcheck drop constraint tcon;0 rows inserted/updated/deletedij> rename table tcheck to tcheck1;0 rows inserted/updated/deletedij> select * from tcheck1;I          |J          -----------------------ij> drop table tcheck1;0 rows inserted/updated/deletedij> -- clean updrop view v1;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 realTab;0 rows inserted/updated/deletedij> drop table t5;0 rows inserted/updated/deletedij> drop table t6r;0 rows inserted/updated/deletedij> drop table t7r;ERROR 42Y55: 'DROP TABLE' cannot be performed on 'T7R' because it does not exist.ij> 

⌨️ 快捷键说明

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