Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2422 05/09/12 17:09:19 gluh@stripped +6 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
produce warning for 'create database if not exists' if database exists
do not update database options in this case
produce warning for 'create table if not exists' if table exists
sql/sql_table.cc
1.302 05/09/12 17:08:36 gluh@stripped +16 -12
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
produce warning for 'create table if not exists' if table exists
sql/sql_db.cc
1.131 05/09/12 17:08:36 gluh@stripped +5 -1
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
produce warning for 'create database if not exists' if database exists
do not update database options in this case
mysql-test/t/create.test
1.59 05/09/12 17:08:36 gluh@stripped +13 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
test case
mysql-test/r/warnings.result
1.31 05/09/12 17:08:36 gluh@stripped +3 -1
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
updated test case result
mysql-test/r/temp_table.result
1.11 05/09/12 17:08:36 gluh@stripped +2 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
updated test case result
mysql-test/r/create.result
1.85 05/09/12 17:08:36 gluh@stripped +28 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
updated test case result
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gluh
# Host: eagle.intranet.mysql.r18.ru
# Root: /home/gluh/MySQL/Bugs/4.1.6008
--- 1.130/sql/sql_db.cc Thu Aug 25 01:07:58 2005
+++ 1.131/sql/sql_db.cc Mon Sep 12 17:08:36 2005
@@ -427,7 +427,11 @@
error= -1;
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
{
--- 1.301/sql/sql_table.cc Wed Aug 31 00:24:33 2005
+++ 1.302/sql/sql_table.cc Mon Sep 12 17:08:36 2005
@@ -1360,6 +1360,9 @@
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
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);
}
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
@@ -1373,12 +1376,8 @@
if (!access(path,F_OK))
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
- {
- create_info->table_existed= 1; // Mark that table existed
- error= 0;
- }
- else
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto end;
}
}
@@ -1401,12 +1400,8 @@
DBUG_PRINT("info", ("Table with same name already existed in handler"));
if (create_if_not_exists)
- {
- create_info->table_existed= 1; // Mark that table existed
- error= 0;
- }
- else
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto end;
}
}
@@ -1447,6 +1442,15 @@
}
}
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:
VOID(pthread_mutex_unlock(&LOCK_open));
start_waiting_global_read_lock(thd);
--- 1.84/mysql-test/r/create.result Tue Aug 30 17:19:10 2005
+++ 1.85/mysql-test/r/create.result Mon Sep 12 17:08:36 2005
@@ -9,6 +9,8 @@
drop table if exists t1;
create table 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);
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
@@ -232,9 +234,13 @@
drop table t1;
create table t1 select 1,2,3;
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;
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
1 2 3
1 2 3
@@ -243,9 +249,13 @@
drop table t1;
create table t1 select 1,2,3;
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;
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
1 2 3
1 2 3
@@ -255,11 +265,15 @@
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;
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
a b
1 1
0 2
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';
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
@@ -593,3 +607,17 @@
create table test.t1 like x;
ERROR 42000: Incorrect database name 'NULL'
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;
--- 1.10/mysql-test/r/temp_table.result Wed Mar 2 07:03:34 2005
+++ 1.11/mysql-test/r/temp_table.result Mon Sep 12 17:08:36 2005
@@ -23,6 +23,8 @@
6 g
create TEMPORARY TABLE t2 engine=heap select * from t1;
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);
ERROR 42S01: Table 't1' already exists
ALTER TABLE t1 RENAME t2;
--- 1.58/mysql-test/t/create.test Thu Sep 1 20:19:15 2005
+++ 1.59/mysql-test/t/create.test Mon Sep 12 17:08:36 2005
@@ -513,4 +513,17 @@
drop table if exists test.t1;
--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
--- 1.30/mysql-test/r/warnings.result Sat Jun 4 15:58:27 2005
+++ 1.31/mysql-test/r/warnings.result Mon Sep 12 17:08:36 2005
@@ -63,9 +63,11 @@
1
create table t1(id int);
create table if not exists t1(id int);
+Warnings:
+Note 1050 Table 't1' already exists
select @@warning_count;
@@warning_count
-0
+1
drop table t1;
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 ',';
| Thread |
|---|
| • bk commit into 4.1 tree (gluh:1.2422) BUG#6008 | gluh | 12 Sep |