diff options
author | unknown <monty@mashka.mysql.fi> | 2003-10-15 21:41:13 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-10-15 21:41:13 +0300 |
commit | b06eb4d81a82be2a215e8b9b726d214c559e3f40 (patch) | |
tree | 1cffa0627ab98f85815d577bb2824198ce5de99b /mysql-test | |
parent | 48446c0f73a99f7cb6a1f00700e6ea066ed28984 (diff) | |
download | mariadb-git-b06eb4d81a82be2a215e8b9b726d214c559e3f40.tar.gz |
Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
Fixed chsize() problem on windows
Extend default timeout on windows clients to 1 year (to avoid timeout problems)
include/mysql.h:
Added client timeouts (for TCP/IP)
libmysql/libmysql.c:
Added client timeouts (for TCP/IP)
mysql-test/r/create.result:
More tests for CREATE TABLE IF NOT EXISTS ... SELECT
mysql-test/t/create.test:
More tests for CREATE TABLE IF NOT EXISTS ... SELECT
mysys/my_chsize.c:
Fix for windows
sql/handler.h:
Remove not used field 'if_not_exists'
Ordered fields to be more optimized for new CPU's
Added field 'table_existed'
sql/slave.cc:
Cleanup temporary tables when slave ends
sql/sql_class.h:
Remove not used 'do_not_drop' field
sql/sql_insert.cc:
Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
sql/sql_table.cc:
Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/create.result | 16 | ||||
-rw-r--r-- | mysql-test/t/create.test | 49 |
2 files changed, 53 insertions, 12 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 3ebe6df21b9..627913939fb 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -200,3 +200,19 @@ select * from t1; 0 1 2 0 0 1 drop table t1; +create table t1 (a int not null, b int, primary key (a)); +insert into t1 values (1,1); +create table if not exists t1 select 2; +select * from t1; +a b +1 1 +0 2 +create table if not exists t1 select 3 as 'a',4 as 'b'; +create table if not exists t1 select 3 as 'a',3 as 'b'; +Duplicate entry '3' for key 1 +select * from t1; +a b +1 1 +0 2 +3 4 +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 815aad560b1..8aee586268f 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -18,21 +18,30 @@ drop table if exists t1; # Test of some CREATE TABLE'S that should fail # -!$1146 create table t2 type=heap select * from t1; -!$1146 create table t2 select auto+1 from t1; +--error 1146 +create table t2 type=heap select * from t1; +--error 1146 +create table t2 select auto+1 from t1; drop table if exists t1,t2; -!$1167 create table t1 (b char(0) not null, index(b)); -!$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap; -!$1163 create table t1 (a int not null,b text) type=heap; +--error 1167 +create table t1 (b char(0) not null, index(b)); +--error 1164 +create table t1 (a int not null auto_increment,primary key (a)) type=heap; +--error 1163 +create table t1 (a int not null,b text) type=heap; drop table if exists t1; -!$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; +--error 1164 +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; -- error 1044,1 create table not_existing_database.test (a int); -!$1103 create table `a/a` (a int); -!$1103 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); -!$1059 create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); +--error 1103 +create table `a/a` (a int); +--error 1103 +create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); +--error 1059 +create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); # # test of dummy table names @@ -123,9 +132,12 @@ drop table t1; # create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); insert into t1 values ("a", 1), ("b", 2); -!$1048 insert into t1 values ("c", NULL); -!$1048 insert into t1 values (NULL, 3); -!$1048 insert into t1 values (NULL, NULL); +--error 1048 +insert into t1 values ("c", NULL); +--error 1048 +insert into t1 values (NULL, 3); +--error 1048 +insert into t1 values (NULL, NULL); drop table t1; # @@ -154,3 +166,16 @@ create table if not exists t1 select 1; select * from t1; drop table t1; +# +# Test create table if not exists with duplicate key error +# + +create table t1 (a int not null, b int, primary key (a)); +insert into t1 values (1,1); +create table if not exists t1 select 2; +select * from t1; +create table if not exists t1 select 3 as 'a',4 as 'b'; +--error 1062 +create table if not exists t1 select 3 as 'a',3 as 'b'; +select * from t1; +drop table t1; |