Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bab5cb78
Commit
bab5cb78
authored
Sep 12, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/gluh/MySQL/Bugs/4.1.6008
parents
0a3202be
63080dc2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
14 deletions
+67
-14
mysql-test/r/create.result
mysql-test/r/create.result
+28
-0
mysql-test/r/temp_table.result
mysql-test/r/temp_table.result
+2
-0
mysql-test/r/warnings.result
mysql-test/r/warnings.result
+3
-1
mysql-test/t/create.test
mysql-test/t/create.test
+13
-0
sql/sql_db.cc
sql/sql_db.cc
+5
-1
sql/sql_table.cc
sql/sql_table.cc
+16
-12
No files found.
mysql-test/r/create.result
View file @
bab5cb78
...
@@ -9,6 +9,8 @@ NULL
...
@@ -9,6 +9,8 @@ NULL
drop table if exists t1;
drop table if exists t1;
create table t1 (b char(0) not null);
create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
Warnings:
Note 1050 Table 't1' already exists
insert into t1 values (""),(null);
insert into t1 values (""),(null);
Warnings:
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
...
@@ -232,9 +234,13 @@ create table t1 select x'4132';
...
@@ -232,9 +234,13 @@ create table t1 select x'4132';
drop table t1;
drop table t1;
create table t1 select 1,2,3;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2;
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1,2,3,4;
ERROR 21S01: Column count doesn't match value count at row 1
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
create table if not exists t1 select 1;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
select * from t1;
1 2 3
1 2 3
1 2 3
1 2 3
...
@@ -243,9 +249,13 @@ select * from t1;
...
@@ -243,9 +249,13 @@ select * from t1;
drop table t1;
drop table t1;
create table t1 select 1,2,3;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2;
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1,2,3,4;
ERROR 21S01: Column count doesn't match value count at row 1
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
create table if not exists t1 select 1;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
select * from t1;
1 2 3
1 2 3
1 2 3
1 2 3
...
@@ -255,11 +265,15 @@ drop table t1;
...
@@ -255,11 +265,15 @@ drop table t1;
create table t1 (a int not null, b int, primary key (a));
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
insert into t1 values (1,1);
create table if not exists t1 select 2;
create table if not exists t1 select 2;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
select * from t1;
a b
a b
1 1
1 1
0 2
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',4 as 'b';
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 3 as 'a',3 as 'b';
create table if not exists t1 select 3 as 'a',3 as 'b';
ERROR 23000: Duplicate entry '3' for key 1
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
select * from t1;
...
@@ -593,3 +607,17 @@ drop database mysqltest;
...
@@ -593,3 +607,17 @@ drop database mysqltest;
create table test.t1 like x;
create table test.t1 like x;
ERROR 42000: Incorrect database name 'NULL'
ERROR 42000: Incorrect database name 'NULL'
drop table if exists test.t1;
drop table if exists test.t1;
create database mysqltest;
create database if not exists mysqltest character set latin2;
Warnings:
Note 1007 Can't create database 'mysqltest'; database exists
show create database mysqltest;
Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
drop database mysqltest;
use test;
create table t1 (a int);
create table if not exists t1 (a int);
Warnings:
Note 1050 Table 't1' already exists
drop table t1;
mysql-test/r/temp_table.result
View file @
bab5cb78
...
@@ -23,6 +23,8 @@ a b
...
@@ -23,6 +23,8 @@ a b
6 g
6 g
create TEMPORARY TABLE t2 engine=heap select * from t1;
create TEMPORARY TABLE t2 engine=heap select * from t1;
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
Warnings:
Note 1050 Table 't2' already exists
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
ERROR 42S01: Table 't1' already exists
ERROR 42S01: Table 't1' already exists
ALTER TABLE t1 RENAME t2;
ALTER TABLE t1 RENAME t2;
...
...
mysql-test/r/warnings.result
View file @
bab5cb78
...
@@ -63,9 +63,11 @@ show count(*) warnings;
...
@@ -63,9 +63,11 @@ show count(*) warnings;
1
1
create table t1(id int);
create table t1(id int);
create table if not exists t1(id int);
create table if not exists t1(id int);
Warnings:
Note 1050 Table 't1' already exists
select @@warning_count;
select @@warning_count;
@@warning_count
@@warning_count
0
1
drop table t1;
drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
...
...
mysql-test/t/create.test
View file @
bab5cb78
...
@@ -513,4 +513,17 @@ create table test.t1 like x;
...
@@ -513,4 +513,17 @@ create table test.t1 like x;
drop
table
if
exists
test
.
t1
;
drop
table
if
exists
test
.
t1
;
--
enable_warnings
--
enable_warnings
#
# Bug #6008 MySQL does not create warnings when
# creating database and using IF NOT EXISTS
#
create
database
mysqltest
;
create
database
if
not
exists
mysqltest
character
set
latin2
;
show
create
database
mysqltest
;
drop
database
mysqltest
;
use
test
;
create
table
t1
(
a
int
);
create
table
if
not
exists
t1
(
a
int
);
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
sql/sql_db.cc
View file @
bab5cb78
...
@@ -427,7 +427,11 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
...
@@ -427,7 +427,11 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
error
=
-
1
;
error
=
-
1
;
goto
exit
;
goto
exit
;
}
}
result
=
0
;
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_DB_CREATE_EXISTS
,
ER
(
ER_DB_CREATE_EXISTS
),
db
);
error
=
0
;
send_ok
(
thd
);
goto
exit
;
}
}
else
else
{
{
...
...
sql/sql_table.cc
View file @
bab5cb78
...
@@ -1360,6 +1360,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -1360,6 +1360,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
{
{
create_info
->
table_existed
=
1
;
// Mark that table existed
create_info
->
table_existed
=
1
;
// Mark that table existed
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_TABLE_EXISTS_ERROR
,
ER
(
ER_TABLE_EXISTS_ERROR
),
alias
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
alias
);
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
alias
);
...
@@ -1373,11 +1376,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -1373,11 +1376,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if
(
!
access
(
path
,
F_OK
))
if
(
!
access
(
path
,
F_OK
))
{
{
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
{
goto
warn
;
create_info
->
table_existed
=
1
;
// Mark that table existed
error
=
0
;
}
else
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
goto
end
;
goto
end
;
}
}
...
@@ -1401,11 +1400,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -1401,11 +1400,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
DBUG_PRINT
(
"info"
,
(
"Table with same name already existed in handler"
));
DBUG_PRINT
(
"info"
,
(
"Table with same name already existed in handler"
));
if
(
create_if_not_exists
)
if
(
create_if_not_exists
)
{
goto
warn
;
create_info
->
table_existed
=
1
;
// Mark that table existed
error
=
0
;
}
else
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
goto
end
;
goto
end
;
}
}
...
@@ -1447,6 +1442,15 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -1447,6 +1442,15 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
}
}
error
=
0
;
error
=
0
;
goto
end
;
warn:
error
=
0
;
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_TABLE_EXISTS_ERROR
,
ER
(
ER_TABLE_EXISTS_ERROR
),
alias
);
create_info
->
table_existed
=
1
;
// Mark that table existed
end:
end:
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
start_waiting_global_read_lock
(
thd
);
start_waiting_global_read_lock
(
thd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment