mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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)
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user