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://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2074 04/11/03 11:52:57 gluh@stripped +6 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
sql/sql_table.cc
1.260 04/11/03 11:52:09 gluh@stripped +16 -12
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
sql/sql_db.cc
1.124 04/11/03 11:52:09 gluh@stripped +2 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
mysql-test/t/create.test
1.49 04/11/03 11:52:09 gluh@stripped +12 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
mysql-test/r/warnings.result
1.28 04/11/03 11:52:09 gluh@stripped +3 -1
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
mysql-test/r/temp_table.result
1.10 04/11/03 11:52:09 gluh@stripped +2 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
mysql-test/r/create.result
1.76 04/11/03 11:52:09 gluh@stripped +25 -0
Fix for bug #6008: MySQL does not create warnings when creating database and using IF
NOT EXISTS
# 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: gluh.mysql.r18.ru
# Root: /home/gluh/MySQL-BUGS/mysql-4.1.6008
--- 1.123/sql/sql_db.cc Mon Oct 25 16:51:20 2004
+++ 1.124/sql/sql_db.cc Wed Nov 3 11:52:09 2004
@@ -415,6 +415,8 @@
error= -1;
goto exit;
}
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), db);
result= 0;
}
else
--- 1.259/sql/sql_table.cc Tue Nov 2 09:58:42 2004
+++ 1.260/sql/sql_table.cc Wed Nov 3 11:52:09 2004
@@ -1208,6 +1208,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);
@@ -1221,12 +1224,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;
}
}
@@ -1250,12 +1249,8 @@
DBUG_PRINT("info", ("Table 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;
}
}
@@ -1297,6 +1292,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.75/mysql-test/r/create.result Tue Aug 31 15:34:59 2004
+++ 1.76/mysql-test/r/create.result Wed Nov 3 11:52:09 2004
@@ -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;
@@ -497,6 +511,17 @@
select database();
database()
NULL
+create database foo;
+create database if not exists foo;
+Warnings:
+Note 1007 Can't create database 'foo'; database exists
+drop database foo;
+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;
select database();
database()
NULL
--- 1.9/mysql-test/r/temp_table.result Wed Dec 10 07:30:26 2003
+++ 1.10/mysql-test/r/temp_table.result Wed Nov 3 11:52:09 2004
@@ -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.48/mysql-test/t/create.test Tue Oct 26 20:29:53 2004
+++ 1.49/mysql-test/t/create.test Wed Nov 3 11:52:09 2004
@@ -402,6 +402,18 @@
drop database mysqltest;
select database();
+#
+# Bug #6008 MySQL does not create warnings when
+# creating database and using IF NOT EXISTS
+#
+create database foo;
+create database if not exists foo;
+drop database foo;
+use test;
+create table t1 (a int);
+create table if not exists t1 (a int);
+drop table t1;
+
# Connect without a database
connect (user4,localhost,mysqltest_1,,*NO-ONE*);
select database();
--- 1.27/mysql-test/r/warnings.result Wed Jun 16 07:18:02 2004
+++ 1.28/mysql-test/r/warnings.result Wed Nov 3 11:52:09 2004
@@ -36,9 +36,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.2074) | gluh | 3 Nov |