66 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
--disable_query_log
 | 
						|
set @@session.explicit_defaults_for_timestamp=off;
 | 
						|
--enable_query_log
 | 
						|
# owner: dachuan.sdc
 | 
						|
# owner group: SQL2
 | 
						|
# description:
 | 
						|
#
 | 
						|
--disable_warnings
 | 
						|
drop database if exists hualong;
 | 
						|
--enable_warnings
 | 
						|
create database hualong;
 | 
						|
use hualong;
 | 
						|
--disable_warnings
 | 
						|
drop table if exists r1;
 | 
						|
--enable_warnings
 | 
						|
--disable_warnings
 | 
						|
drop table if exists r2;
 | 
						|
--enable_warnings
 | 
						|
create table hualong.r1(c1 int not null primary key, c2 int);
 | 
						|
create table hualong.r2(a int not null primary key , b int);
 | 
						|
--error 1050
 | 
						|
rename table r1 to r2;
 | 
						|
--error 1050
 | 
						|
alter table r1 rename to r2;
 | 
						|
--error 1050
 | 
						|
rename table r1 to r3, r2 to r3;
 | 
						|
--error 1050
 | 
						|
rename table r1 to r3, r1 to r3;
 | 
						|
--error 1017
 | 
						|
rename table r1 to r3, r1 to r4;
 | 
						|
#表xx不存在, ti存在, 先报ti存在
 | 
						|
--error 1050
 | 
						|
rename table xx to r1;
 | 
						|
--error 1049
 | 
						|
rename table xx to a.xxx;
 | 
						|
rename table r1 to table1, table1 to r1;
 | 
						|
rename table r1 to r3, r2 to r1;
 | 
						|
--error 1050
 | 
						|
rename table r3 to r3;
 | 
						|
--disable_warnings
 | 
						|
drop database if exists hualong2;
 | 
						|
--enable_warnings
 | 
						|
create database hualong2;
 | 
						|
rename table hualong.r1 to hualong2.r1;
 | 
						|
show tables from hualong;
 | 
						|
show tables from hualong2;
 | 
						|
 | 
						|
create index idx1 on hualong.r3(c1);
 | 
						|
rename table hualong.r3 to hualong2.r2;
 | 
						|
show tables from hualong;
 | 
						|
show tables from hualong2;
 | 
						|
--source mysql_test/include/check_all_idx_ok.inc
 | 
						|
show index from hualong2.r2;
 | 
						|
rename table hualong2.r2 to hualong.r2;
 | 
						|
--source mysql_test/include/check_all_idx_ok.inc
 | 
						|
show index from hualong.r2;
 | 
						|
show tables from hualong;
 | 
						|
 | 
						|
rename table hualong2.r1 to hualong.r1;
 | 
						|
rename table r1 to tmp, tmp to r1, r2 to tmp;
 | 
						|
show tables from hualong;
 | 
						|
 | 
						|
drop table hualong.r1, hualong.tmp;
 | 
						|
drop database hualong;
 | 
						|
drop database hualong2;
 |