diff options
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r-- | mysql-test/t/create.test | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 3bad053875c..70a589c4be6 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2,7 +2,10 @@ # Check some special create statements. # -drop table if exists t1,t2; +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -12,7 +15,7 @@ create table t1 (b char(0) not null); create table if not exists t1 (b char(0) not null); insert into t1 values (""),(null); select * from t1; -drop table if exists t1; +drop table t1; # # Test of some CREATE TABLE'S that should fail @@ -91,11 +94,14 @@ create table t2 (a int) select * from t1; describe t1; describe t2; drop table if exists t2; -!$1060 create table t2 (a int, a float) select * from t1; +--error 1060 +create table t2 (a int, a float) select * from t1; drop table if exists t2; -!$1060 create table t2 (a int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (a int) select a as b, a+1 as b from t1; drop table if exists t2; -!$1060 create table t2 (b int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (b int) select a as b, a+1 as b from t1; drop table if exists t1,t2; # @@ -113,3 +119,43 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; + +# +# Test for CREATE TABLE .. LIKE .. +# + +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +select * from t3; +create table if not exists t3 like t1; +select @@warning_count; +create temporary table t3 like t2; +show create table t3; +select * from t3; +drop table t3; +show create table t3; +select * from t3; +drop table t2, t3; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +create table t2 like t3; +show create table t2; +select * from t2; +create table t3 like t1; +!$1050 create table t3 like test_$1.t3; +--error 1044,1 +create table non_existing_database.t1 like t1; +!$1051 create table t3 like non_existing_table; +!$1050 create temporary table t3 like t1; +!$1103 create table t3 like `a/a`; +drop table t1, t2, t3; +drop table t3; +drop database test_$1; + |