rename.test
Upload User: tsgydb
Upload Date: 2007-04-14
Package Size: 10674k
Code Size: 1k
Category:

MySQL

Development Platform:

Visual C++

  1. #
  2. # Test of rename table
  3. #
  4. drop table if exists t0,t1,t2,t3,t4;
  5. create table t0 SELECT 1,"table 1";
  6. create table t2 SELECT 2,"table 2";
  7. create table t3 SELECT 3,"table 3";
  8. rename table t0 to t1;
  9. rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
  10. select * from t1;
  11. rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
  12. rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
  13. select * from t1;
  14. # The following should give errors
  15. !$1050 rename table t1 to t2;
  16. !$1050 rename table t1 to t1;
  17. !$1050 rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
  18. show tables like "t_";
  19. !$1050 rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
  20. !$1017 rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
  21. select * from t1;
  22. select * from t2;
  23. select * from t3;
  24. drop table if exists t1,t2,t3,t4;