diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2002-12-28 21:37:16 +0200 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2002-12-28 21:37:16 +0200 |
commit | 13587ca070a75fa10882f03ae4a46a89b2374355 (patch) | |
tree | ed559bd5ebeb72916bcfa5ce7fdd4634dfa7002b /mysql-test | |
parent | 84a9a9fe5bc7583905672c0b94011cfa1606b08d (diff) | |
parent | a3fecf4ad407ceb34c428e1f7fe36663d5ffbd6a (diff) | |
download | mariadb-git-13587ca070a75fa10882f03ae4a46a89b2374355.tar.gz |
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/create.result | 60 | ||||
-rw-r--r-- | mysql-test/t/create.test | 37 |
2 files changed, 97 insertions, 0 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 0be0d624fca..e1c5bb61da9 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -161,3 +161,63 @@ 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; +drop table if exists t1, t2, t3; +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; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +create table if not exists t3 like t1; +Warnings: +Warning 1050 Table 't3' already exists +select @@warning_count; +@@warning_count +1 +create temporary table t3 like t2; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0' +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id +drop table t3; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +drop table t3; +create database test_$1; +drop table if exists test_$1.t3; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +create table t3 like t1; +create table t3 like test_$1.t3; +Table 't3' already exists +create table non_existing_database.t1 like t1; +Got one of the listed errors +create table t3 like non_existing_table; +Unknown table 'non_existing_table' +create temporary table t3 like t1; +Table 't3' already exists +drop table t1, t2, t3; +drop table t3; +drop database test_$1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 3bad053875c..f5f5116b429 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -113,3 +113,40 @@ 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 .. +# + +drop table if exists t1, t2, t3; +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 t3; +create database test_$1; +drop table if exists test_$1.t3; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +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; +drop table t1, t2, t3; +drop table t3; +drop database test_$1; + |