From ca345dede4a001abb2ec06aa5feec34bed38f0e6 Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Tue, 22 Nov 2005 18:29:46 +0400 Subject: [PATCH 01/27] Fix for bug #10966: Variance functions return wrong data type. --- mysql-test/r/func_group.result | 14 ++++++++++++++ mysql-test/t/func_group.test | 11 +++++++++++ sql/item_sum.cc | 3 --- sql/item_sum.h | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 2b0176179ed..2a182057738 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1089,3 +1089,17 @@ SUM(a) 6 DROP TABLE t1; set div_precision_increment= @sav_dpi; +create table t1 select variance(0); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `variance(0)` double(8,4) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 select stddev(0); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `stddev(0)` double(8,4) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index c667f90940c..7e102ebaf29 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -703,3 +703,14 @@ SELECT SUM(a) FROM t1 GROUP BY b/c; DROP TABLE t1; set div_precision_increment= @sav_dpi; +# +# Bug #10966: Variance functions return wrong data type +# + +create table t1 select variance(0); +show create table t1; +drop table t1; +create table t1 select stddev(0); +show create table t1; +drop table t1; + \ No newline at end of file diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b2eaf39d624..027655e5cc7 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1030,9 +1030,6 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, sizeof(double)*2) + sizeof(longlong), 0, name, table, &my_charset_bin); } - if (hybrid_type == DECIMAL_RESULT) - return new Field_new_decimal(max_length, maybe_null, name, table, - decimals, unsigned_flag); return new Field_double(max_length, maybe_null,name,table,decimals); } diff --git a/sql/item_sum.h b/sql/item_sum.h index 87cc248e5e4..7340dc78c66 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -481,7 +481,7 @@ public: { return sample ? "var_samp(" : "variance("; } Item *copy_or_same(THD* thd); Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); - enum Item_result result_type () const { return hybrid_type; } + enum Item_result result_type () const { return REAL_RESULT; } }; class Item_sum_std; From 2e0cad5404e925b3bbe9095174617412bc92b45b Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 7 Jun 2006 14:07:11 +0200 Subject: [PATCH 02/27] Bug#20159 Inconsistant generation of generic error messages - Use hardcoded error message instead of ER_GET_ERRNO --- sql/sql_udf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 6269c0a2eb3..bea3d547f3e 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -237,7 +237,7 @@ void udf_init() } } if (error > 0) - sql_print_error(ER(ER_GET_ERRNO), my_errno); + sql_print_error("Got unknown error: %d", my_errno); end_read_record(&read_record_info); new_thd->version--; // Force close to free memory From 9ebf7944e36df42ea5bb61b34e32c8af0f4bc909 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 9 Jun 2006 19:35:54 +0200 Subject: [PATCH 03/27] Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT - Add unsigned flag to user_var_entry, used when 'type' is INT_RESULT - Propagate unsigned flag from the query executed by Item_single_row_subselect --- mysql-test/r/user_var.result | 36 ++++++++++++++++++++++++++++++++++++ mysql-test/t/user_var.test | 31 +++++++++++++++++++++++++++++++ sql/item_func.cc | 24 +++++++++++++++++------- sql/item_func.h | 6 ++---- sql/item_subselect.cc | 1 + sql/sql_class.h | 1 + 6 files changed, 88 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 7439f9132fb..3a197cd2a47 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -256,3 +256,39 @@ t1 CREATE TABLE `t1` ( `@first_var` longtext ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +set @a=18446744071710965857; +select @a; +@a +18446744071710965857 +CREATE TABLE `bigfailure` ( +`afield` BIGINT UNSIGNED NOT NULL +); +INSERT INTO `bigfailure` VALUES (18446744071710965857); +SELECT * FROM bigfailure; +afield +18446744071710965857 +select * from (SELECT afield FROM bigfailure) as b; +afield +18446744071710965857 +select * from bigfailure where afield = (SELECT afield FROM bigfailure); +afield +18446744071710965857 +select * from bigfailure where afield = 18446744071710965857; +afield +18446744071710965857 +select * from bigfailure where afield = 18446744071710965856+1; +afield +18446744071710965857 +SET @a := (SELECT afield FROM bigfailure); +SELECT @a; +@a +18446744071710965857 +SET @a := (select afield from (SELECT afield FROM bigfailure) as b); +SELECT @a; +@a +18446744071710965857 +SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure)); +SELECT @a; +@a +18446744071710965857 +drop table bigfailure; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index e1b23a1782f..58c52b59a5a 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -171,3 +171,34 @@ set @first_var= cast(NULL as CHAR); create table t1 select @first_var; show create table t1; drop table t1; + +# +# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT +# + +# First part, set user var to large number and select it +set @a=18446744071710965857; +select @a; + +# Second part, set user var from large number in table +# then select it +CREATE TABLE `bigfailure` ( + `afield` BIGINT UNSIGNED NOT NULL +); +INSERT INTO `bigfailure` VALUES (18446744071710965857); +SELECT * FROM bigfailure; +select * from (SELECT afield FROM bigfailure) as b; +select * from bigfailure where afield = (SELECT afield FROM bigfailure); +select * from bigfailure where afield = 18446744071710965857; +# This is fixed in 5.0, to be uncommented there +#select * from bigfailure where afield = '18446744071710965857'; +select * from bigfailure where afield = 18446744071710965856+1; + +SET @a := (SELECT afield FROM bigfailure); +SELECT @a; +SET @a := (select afield from (SELECT afield FROM bigfailure) as b); +SELECT @a; +SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure)); +SELECT @a; + +drop table bigfailure; diff --git a/sql/item_func.cc b/sql/item_func.cc index 6ec74560b91..7450451b0d0 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3408,6 +3408,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->length=0; entry->update_query_id=0; entry->collation.set(NULL, DERIVATION_IMPLICIT); + entry->unsigned_flag= 0; /* If we are here, we were called from a SET or a query which sets a variable. Imagine it is this: @@ -3494,6 +3495,7 @@ Item_func_set_user_var::fix_length_and_dec() type - type of new value cs - charset info for new value dv - derivation for new value + unsigned_arg - indiates if a value of type INT_RESULT is unsigned RETURN VALUE False - success, True - failure @@ -3501,7 +3503,8 @@ Item_func_set_user_var::fix_length_and_dec() static bool update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, - Item_result type, CHARSET_INFO *cs, Derivation dv) + Item_result type, CHARSET_INFO *cs, Derivation dv, + bool unsigned_arg) { if (set_null) { @@ -3549,6 +3552,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, ((my_decimal*)entry->value)->fix_buffer_pointer(); entry->length= length; entry->collation.set(cs, dv); + entry->unsigned_flag= unsigned_arg; } entry->type=type; return 0; @@ -3557,7 +3561,8 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, bool Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type, - CHARSET_INFO *cs, Derivation dv) + CHARSET_INFO *cs, Derivation dv, + bool unsigned_arg) { /* If we set a variable explicitely to NULL then keep the old @@ -3566,7 +3571,7 @@ Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type, if ((null_value= args[0]->null_value) && null_item) type= entry->type; // Don't change type of item if (::update_hash(entry, (null_value= args[0]->null_value), - ptr, length, type, cs, dv)) + ptr, length, type, cs, dv, unsigned_arg)) { current_thd->fatal_error(); // Probably end of memory null_value= 1; @@ -3648,7 +3653,10 @@ String *user_var_entry::val_str(my_bool *null_value, String *str, str->set(*(double*) value, decimals, &my_charset_bin); break; case INT_RESULT: - str->set(*(longlong*) value, &my_charset_bin); + if (!unsigned_flag) + str->set(*(longlong*) value, &my_charset_bin); + else + str->set(*(ulonglong*) value, &my_charset_bin); break; case DECIMAL_RESULT: my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str); @@ -3719,6 +3727,7 @@ Item_func_set_user_var::check() case INT_RESULT: { save_result.vint= args[0]->val_int(); + unsigned_flag= args[0]->unsigned_flag; break; } case STRING_RESULT: @@ -3774,7 +3783,8 @@ Item_func_set_user_var::update() case INT_RESULT: { res= update_hash((void*) &save_result.vint, sizeof(save_result.vint), - INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT); + INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, + unsigned_flag); break; } case STRING_RESULT: @@ -4141,7 +4151,7 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs) { if (::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs, - DERIVATION_IMPLICIT)) + DERIVATION_IMPLICIT, 0 /* unsigned_arg */)) current_thd->fatal_error(); // Probably end of memory } @@ -4150,7 +4160,7 @@ void Item_user_var_as_out_param::set_value(const char *str, uint length, CHARSET_INFO* cs) { if (::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs, - DERIVATION_IMPLICIT)) + DERIVATION_IMPLICIT, 0 /* unsigned_arg */)) current_thd->fatal_error(); // Probably end of memory } diff --git a/sql/item_func.h b/sql/item_func.h index a91d93be8c6..8f90626ad26 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1154,8 +1154,6 @@ class Item_func_set_user_var :public Item_func String *vstr; my_decimal *vdec; } save_result; - String save_buff; - public: LEX_STRING name; // keep it public @@ -1166,8 +1164,8 @@ public: longlong val_int(); String *val_str(String *str); my_decimal *val_decimal(my_decimal *); - bool update_hash(void *ptr, uint length, enum Item_result type, - CHARSET_INFO *cs, Derivation dv); + bool update_hash(void *ptr, uint length, enum Item_result type, + CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0); bool check(); bool update(); enum Item_result result_type () const { return cached_result_type; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index d93f6501ebb..4e6b168c9e9 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1497,6 +1497,7 @@ static Item_result set_row(List &item_list, Item *item, item->max_length= sel_item->max_length; res_type= sel_item->result_type(); item->decimals= sel_item->decimals; + item->unsigned_flag= sel_item->unsigned_flag; *maybe_null= sel_item->maybe_null; if (!(row[i]= Item_cache::get_cache(res_type))) return STRING_RESULT; // we should return something diff --git a/sql/sql_class.h b/sql/sql_class.h index 0ddba0e6f05..be13084b1ea 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1954,6 +1954,7 @@ class user_var_entry ulong length; query_id_t update_query_id, used_query_id; Item_result type; + bool unsigned_flag; double val_real(my_bool *null_value); longlong val_int(my_bool *null_value); From 4ca95f911a5e5c74bb3fcb1141d1ddd065aa9ed0 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 12 Jun 2006 13:07:40 +0200 Subject: [PATCH 04/27] Bug#19517 No simple way to detect wether server was compiled with libdbug - Define DBUG_ON and DBUG_OFF in config.h --- configure.in | 15 +++++++++------ dbug/dbug.c | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index 3c335089688..8755fd1a3bb 100644 --- a/configure.in +++ b/configure.in @@ -1651,17 +1651,20 @@ AC_ARG_WITH(debug, if test "$with_debug" = "yes" then # Medium debug. - CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS" + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS" + CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" elif test "$with_debug" = "full" then # Full debug. Very slow in some cases - CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" + CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" else # Optimized version. No debug - CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS" - CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" + AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) + CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS" + CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS" fi # Force static compilation to avoid linking problems/get more speed diff --git a/dbug/dbug.c b/dbug/dbug.c index c991daf3617..575481305e7 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -66,10 +66,13 @@ * Check of malloc on entry/exit (option "S") */ +#include + +/* This file won't compile unless DBUG_OFF is undefined locally */ #ifdef DBUG_OFF #undef DBUG_OFF #endif -#include + #include #include #if defined(MSDOS) || defined(__WIN__) From 9c18b5752c22efdfbfc6427747dbbc6092961bbd Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Mon, 10 Jul 2006 19:50:40 -0700 Subject: [PATCH 05/27] Bug #18539: uncompress(d) is null: impossible? The UNCOMPRESS() function was not marked as maybe_null, even though it returns NULL on invalid data. This confused the optimizer. --- mysql-test/r/func_compress.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/func_compress.test | 14 ++++++++++++++ sql/item_strfunc.h | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index e3d31566741..df8939d98f1 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -79,3 +79,31 @@ uncompress(a) uncompressed_length(a) NULL NULL a 1 drop table t1; +create table t1 (a varchar(32) not null); +insert into t1 values ('foo'); +explain select * from t1 where uncompress(a) is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +Warnings: +Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +select * from t1 where uncompress(a) is null; +a +foo +Warnings: +Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +explain select *, uncompress(a) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +select *, uncompress(a) from t1; +a uncompress(a) +foo NULL +Warnings: +Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +select *, uncompress(a), uncompress(a) is null from t1; +a uncompress(a) uncompress(a) is null +foo NULL 1 +Warnings: +Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +drop table t1; +End of 5.0 tests diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 4ae749f2343..eeb5d509b94 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -57,3 +57,17 @@ select uncompress(a), uncompressed_length(a) from t1; drop table t1; # End of 4.1 tests + +# +# Bug #18539: uncompress(d) is null: impossible? +# +create table t1 (a varchar(32) not null); +insert into t1 values ('foo'); +explain select * from t1 where uncompress(a) is null; +select * from t1 where uncompress(a) is null; +explain select *, uncompress(a) from t1; +select *, uncompress(a) from t1; +select *, uncompress(a), uncompress(a) is null from t1; +drop table t1; + +--echo End of 5.0 tests diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index af59b8d740b..d685bd63467 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -784,7 +784,7 @@ class Item_func_uncompress: public Item_str_func String buffer; public: Item_func_uncompress(Item *a): Item_str_func(a){} - void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;} + void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; } const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION }; From 794fe3435c865a6d3580e4ad83b8469a7b63b81d Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Wed, 12 Jul 2006 11:38:11 +0500 Subject: [PATCH 06/27] Fix for bug #19370: DateTime datatype in MySQL has two bugs in it --- mysql-test/r/date_formats.result | 4 +++- mysql-test/r/strict.result | 20 ++++++++++++++------ mysql-test/r/type_datetime.result | 4 +++- mysql-test/t/strict.test | 18 ++++++++++++++++-- sql-common/my_time.c | 4 +++- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 77a3473e9fe..e427fd543c6 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -449,6 +449,8 @@ create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:% str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2, str_to_date("2003-01-02", "%Y-%m-%d") as f3, str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5; +Warnings: +Warning 1265 Data truncated for column 'f4' at row 1 describe t1; Field Type Null Key Default Extra f1 datetime YES NULL @@ -458,7 +460,7 @@ f4 date YES NULL f5 time YES NULL select * from t1; f1 f2 f3 f4 f5 -2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00 +2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00 drop table t1; create table t1 select "02 10" as a, "%d %H" as b; select str_to_date(a,b) from t1; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index d0cf11d0511..08a33734910 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -5,7 +5,9 @@ select @@sql_mode; REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER DROP TABLE IF EXISTS t1; CREATE TABLE t1 (col1 date); -INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29'); +INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); +INSERT INTO t1 VALUES('0000-10-31'); +ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1 INSERT INTO t1 VALUES('2004-0-31'); ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1 INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31'); @@ -54,7 +56,6 @@ Warning 1265 Data truncated for column 'col1' at row 3 select * from t1; col1 2004-01-01 -0000-10-31 2004-02-29 2004-01-02 2004-01-03 @@ -121,7 +122,9 @@ col1 drop table t1; set @@sql_mode='ansi,traditional'; CREATE TABLE t1 (col1 datetime); -INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00'); +INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); +INSERT INTO t1 VALUES('0000-10-31 15:30:00'); +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 VALUES('2004-0-31 15:30:00'); ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 VALUES('2004-10-0 15:30:00'); @@ -141,7 +144,6 @@ ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1 select * from t1; col1 2004-10-31 15:30:00 -0000-10-31 15:30:00 2004-02-29 15:30:00 drop table t1; CREATE TABLE t1 (col1 timestamp); @@ -204,6 +206,7 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y')); INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); +ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -219,6 +222,7 @@ ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_ti INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -255,6 +259,7 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE)); INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); +ERROR 22007: Truncated incorrect datetime value: '0000-10-31' INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE)); ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE)); @@ -262,6 +267,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); ERROR 22007: Truncated incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); +ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); @@ -269,7 +275,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); ERROR 22007: Truncated incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); @@ -282,6 +288,7 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE)); INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); +ERROR 22007: Truncated incorrect datetime value: '0000-10-31' INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE)); ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); @@ -289,6 +296,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); ERROR 22007: Truncated incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); +ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); @@ -296,7 +304,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); ERROR 22007: Truncated incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 85f899be5d8..2addb9c93eb 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -26,6 +26,8 @@ Table Op Msg_type Msg_text test.t1 check status OK delete from t1; insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000"); +Warnings: +Warning 1264 Out of range value adjusted for column 't' at row 5 insert into t1 values ("2003-003-03"); insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01"); select * from t1; @@ -34,7 +36,7 @@ t 2069-12-31 00:00:00 1970-01-01 00:00:00 1999-12-31 00:00:00 -0000-01-01 00:00:00 +0000-00-00 00:00:00 0001-01-01 00:00:00 9999-12-31 00:00:00 2000-10-10 00:00:00 diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index ce269b42ee9..6f22b81172d 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -13,7 +13,9 @@ DROP TABLE IF EXISTS t1; # Test INSERT with DATE CREATE TABLE t1 (col1 date); -INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29'); +INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); +--error 1292 +INSERT INTO t1 VALUES('0000-10-31'); # All test cases expected to fail should return # SQLSTATE 22007 @@ -97,7 +99,9 @@ set @@sql_mode='ansi,traditional'; # Test INSERT with DATETIME CREATE TABLE t1 (col1 datetime); -INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00'); +INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); +--error 1292 +INSERT INTO t1 VALUES('0000-10-31 15:30:00'); # All test cases expected to fail should return # SQLSTATE 22007 @@ -190,6 +194,7 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); # All test cases expected to fail should return # SQLSTATE 22007 +--error 1292 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); --error 1292 @@ -211,6 +216,7 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); # All test cases expected to fail should return # SQLSTATE 22007 +--error 1292 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); --error 1292 @@ -264,6 +270,8 @@ INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); ## Test INSERT with CAST AS DATE into DATE # All test cases expected to fail should return # SQLSTATE 22007 + +--error 1292 INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); --error 1292 @@ -290,6 +298,8 @@ INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); ## Test INSERT with CAST AS DATETIME into DATETIME # All test cases expected to fail should return # SQLSTATE 22007 + +--error 1292 INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); --error 1292 @@ -356,6 +366,8 @@ INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); ## Test INSERT with CONVERT to DATE into DATE # All test cases expected to fail should return # SQLSTATE 22007 + +--error 1292 INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); --error 1292 @@ -381,6 +393,8 @@ INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); ## Test INSERT with CONVERT to DATETIME into DATETIME # All test cases expected to fail should return # SQLSTATE 22007 + +--error 1292 INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); --error 1292 diff --git a/sql-common/my_time.c b/sql-common/my_time.c index c9d39260761..93bf23ed284 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -69,6 +69,7 @@ uint calc_days_in_year(uint year) Here we assume that year and month is ok ! If month is 0 we allow any date. (This only happens if we allow zero date parts in str_to_datetime()) + Disallow dates with zero year and non-zero month and/or day. RETURN 0 ok @@ -85,7 +86,8 @@ static my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, (!(flags & TIME_INVALID_DATES) && ltime->month && ltime->day > days_in_month[ltime->month-1] && (ltime->month != 2 || calc_days_in_year(ltime->year) != 366 || - ltime->day != 29))) + ltime->day != 29)) || + (ltime->year == 0 && (ltime->month != 0 || ltime->day != 0))) { *was_cut= 2; return TRUE; From 30d7290c2127e709bd9d8753eebbb67114a0b94d Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Wed, 12 Jul 2006 13:22:38 -0700 Subject: [PATCH 07/27] Bug #17903: cast to char results in binary The character set was not being properly initialized in CAST() with a type like "CHAR(2) BINARY", which resulted in incorrect results or even a crash. --- mysql-test/r/cast.result | 11 +++++++++++ mysql-test/t/cast.test | 14 +++++++++++++- sql/sql_yacc.yy | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index d60efa083e0..a07ca21652b 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -381,3 +381,14 @@ DROP TABLE t1; select cast(NULL as decimal(6)) as t1; t1 NULL +set names latin1; +select hex(cast('a' as char(2) binary)); +hex(cast('a' as char(2) binary)) +61 +select hex(cast('a' as binary(2))); +hex(cast('a' as binary(2))) +6100 +select hex(cast('a' as char(2) binary)); +hex(cast('a' as char(2) binary)) +61 +End of 5.0 tests diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 533da542855..ecc92ed01d1 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -204,7 +204,19 @@ SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL), CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1; DROP TABLE t1; -# Bug @10237 (CAST(NULL DECIMAL) crashes server) + +# +# Bug #10237 (CAST(NULL DECIMAL) crashes server) # select cast(NULL as decimal(6)) as t1; + +# +# Bug #17903: cast to char results in binary +# +set names latin1; +select hex(cast('a' as char(2) binary)); +select hex(cast('a' as binary(2))); +select hex(cast('a' as char(2) binary)); + +--echo End of 5.0 tests diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index deac9cb5c40..a730e2533b1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3089,7 +3089,7 @@ opt_bin_mod: | BINARY { Lex->type|= BINCMP_FLAG; }; opt_bin_charset: - /* empty */ { } + /* empty */ { Lex->charset= NULL; } | ASCII_SYM { Lex->charset=&my_charset_latin1; } | UNICODE_SYM { From 2d43d0675e86339d71e3a9c3d72e5e2995e71411 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 18 Jul 2006 12:41:41 +0200 Subject: [PATCH 08/27] Bug#18539 uncompress(d) is null: impossible? - Add a check that length of field to uncompress is longer than 4 bytes. This can be dones as the length of uncompressed data is written as first four bytes of field and thus it can't be valid compressed data. --- mysql-test/r/func_compress.result | 10 +++++----- sql/item_strfunc.cc | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index df8939d98f1..00d5ebfc351 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -85,12 +85,12 @@ explain select * from t1 where uncompress(a) is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 Warnings: -Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +Error 1259 ZLIB: Input data corrupted select * from t1 where uncompress(a) is null; a foo Warnings: -Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +Error 1259 ZLIB: Input data corrupted explain select *, uncompress(a) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 @@ -98,12 +98,12 @@ select *, uncompress(a) from t1; a uncompress(a) foo NULL Warnings: -Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +Error 1259 ZLIB: Input data corrupted select *, uncompress(a), uncompress(a) is null from t1; a uncompress(a) uncompress(a) is null foo NULL 1 Warnings: -Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) -Error 1256 Uncompressed data size too large; the maximum size is 104857600 (probably, length of uncompressed data was corrupted) +Error 1259 ZLIB: Input data corrupted +Error 1259 ZLIB: Input data corrupted drop table t1; End of 5.0 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 97ed15c8bb7..a524e4e3056 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2965,6 +2965,16 @@ String *Item_func_uncompress::val_str(String *str) if (res->is_empty()) return res; + /* If length is less than 4 bytes, data is corrupt */ + if (res->length() <= 4) + { + push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_ZLIB_Z_DATA_ERROR, + ER(ER_ZLIB_Z_DATA_ERROR)); + goto err; + } + + /* Size of uncompressed data is stored as first 4 bytes of field */ new_size= uint4korr(res->ptr()) & 0x3FFFFFFF; if (new_size > current_thd->variables.max_allowed_packet) { From d18eacc71d5c869bec9bcf9e7ba450c721ae3e90 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Tue, 18 Jul 2006 16:04:18 -0700 Subject: [PATCH 09/27] Bug #19498: Inconsistent support for DEFAULT in TEXT columns When a default of '' was specified for TEXT/BLOB columns, the specification was silently ignored. This is presumably to be nice to applications (or people) who generate their column definitions in a not-very-clever fashion. For clarity, doing this now results in a warning, or an error in strict mode. --- mysql-test/r/federated.result | 4 ++++ mysql-test/r/fulltext_distinct.result | 2 ++ mysql-test/r/fulltext_update.result | 2 ++ mysql-test/r/gis-rtree.result | 6 ++++++ mysql-test/r/gis.result | 2 ++ mysql-test/r/join_outer.result | 2 ++ mysql-test/r/order_by.result | 2 ++ mysql-test/r/type_blob.result | 20 ++++++++++++++++++++ mysql-test/r/type_ranges.result | 3 +++ mysql-test/t/type_blob.test | 15 +++++++++++++++ sql/field.cc | 21 +++++++++++++++++++-- 11 files changed, 77 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 709e44579e2..baf8641c9e9 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -967,6 +967,8 @@ CREATE TABLE federated.t1 ( `blurb` text default '', PRIMARY KEY (blurb_id)) DEFAULT CHARSET=latin1; +Warnings: +Warning 1101 BLOB/TEXT column 'blurb' can't have a default value DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `blurb_id` int NOT NULL DEFAULT 0, @@ -975,6 +977,8 @@ PRIMARY KEY (blurb_id)) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +Warnings: +Warning 1101 BLOB/TEXT column 'blurb' can't have a default value INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result index de0668ff28c..7fd42fab646 100644 --- a/mysql-test/r/fulltext_distinct.result +++ b/mysql-test/r/fulltext_distinct.result @@ -8,6 +8,8 @@ KEY kt(tag), KEY kv(value(15)), FULLTEXT KEY kvf(value) ) ENGINE=MyISAM; +Warnings: +Warning 1101 BLOB/TEXT column 'value' can't have a default value CREATE TABLE t2 ( id_t2 mediumint unsigned NOT NULL default '0', id_t1 mediumint unsigned NOT NULL default '0', diff --git a/mysql-test/r/fulltext_update.result b/mysql-test/r/fulltext_update.result index 5d3f95b318c..4a615c88fdd 100644 --- a/mysql-test/r/fulltext_update.result +++ b/mysql-test/r/fulltext_update.result @@ -9,6 +9,8 @@ name VARCHAR(80) DEFAULT '' NOT NULL, FULLTEXT(url,description,shortdesc,longdesc), PRIMARY KEY(gnr) ); +Warnings: +Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value insert into test (url,shortdesc,longdesc,description,name) VALUES ("http:/test.at", "kurz", "lang","desc", "name"); insert into test (url,shortdesc,longdesc,description,name) VALUES diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index 28c59053435..b283d64395d 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -804,6 +804,8 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1; ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1, t2; CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1; +Warnings: +Warning 1101 BLOB/TEXT column 'geometry' can't have a default value INSERT INTO t1 (geometry) VALUES (PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000 -66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999, @@ -820,6 +822,8 @@ CREATE TABLE t1 ( c1 geometry NOT NULL default '', SPATIAL KEY i1 (c1(32)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +Warnings: +Warning 1101 BLOB/TEXT column 'c1' can't have a default value INSERT INTO t1 (c1) VALUES ( PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000 -66.8158332999, @@ -834,6 +838,8 @@ CREATE TABLE t1 ( c1 geometry NOT NULL default '', SPATIAL KEY i1 (c1(32)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +Warnings: +Warning 1101 BLOB/TEXT column 'c1' can't have a default value INSERT INTO t1 (c1) VALUES ( PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000 -66.8158332999, diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 7a0f689df36..e37dca9e86c 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -583,6 +583,8 @@ t1 CREATE TABLE `t1` ( drop table t1; CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` geometry NOT NULL default '') ENGINE=MyISAM ; +Warnings: +Warning 1101 BLOB/TEXT column 'geo' can't have a default value insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363 36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index eae023813b5..a983b32ba46 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -598,6 +598,8 @@ id int(11) DEFAULT '0' NOT NULL, name tinytext DEFAULT '' NOT NULL, UNIQUE id (id) ); +Warnings: +Warning 1101 BLOB/TEXT column 'name' can't have a default value INSERT INTO t1 VALUES (1,'yes'),(2,'no'); CREATE TABLE t2 ( id int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index a36935a583d..9756ab49ac7 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -280,6 +280,8 @@ info text NOT NULL default '', ipnr varchar(30) NOT NULL default '', PRIMARY KEY (member_id) ) ENGINE=MyISAM PACK_KEYS=1; +Warnings: +Warning 1101 BLOB/TEXT column 'info' can't have a default value insert into t1 (member_id) values (1),(2),(3); select member_id, nickname, voornaam FROM t1 ORDER by lastchange_datum DESC LIMIT 2; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 4fd220045c2..73b67a2241e 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -503,6 +503,8 @@ foobar boggle fish 10 drop table t1; create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default ''); +Warnings: +Warning 1101 BLOB/TEXT column 'imagem' can't have a default value insert into t1 (id) values (1); select charset(load_file('../../std_data/words.dat')), @@ -788,3 +790,21 @@ NULL 616100000000 620000000000 drop table t1; +create table t1 (a text default ''); +Warnings: +Warning 1101 BLOB/TEXT column 'a' can't have a default value +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (default); +select * from t1; +a +NULL +drop table t1; +set @@sql_mode='TRADITIONAL'; +create table t1 (a text default ''); +ERROR 42000: BLOB/TEXT column 'a' can't have a default value +set @@sql_mode=''; +End of 5.0 tests diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index bd89c09e94d..cfbe11b975e 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -38,6 +38,9 @@ KEY (ulong), KEY (ulonglong,ulong), KEY (options,flags) ); +Warnings: +Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value +Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value show full fields from t1; Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned NULL NO PRI NULL auto_increment # diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 503d7ffc0b9..6d79dcc863b 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -423,3 +423,18 @@ alter table t1 modify a binary(5); select hex(a) from t1 order by a; select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0'); drop table t1; + +# +# Bug #19489: Inconsistent support for DEFAULT in TEXT columns +# +create table t1 (a text default ''); +show create table t1; +insert into t1 values (default); +select * from t1; +drop table t1; +set @@sql_mode='TRADITIONAL'; +--error ER_BLOB_CANT_HAVE_DEFAULT +create table t1 (a text default ''); +set @@sql_mode=''; + +--echo End of 5.0 tests diff --git a/sql/field.cc b/sql/field.cc index 946351efe36..31184a9f08c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8363,7 +8363,8 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, comment= *fld_comment; /* - Set flag if this field doesn't have a default value + Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and + it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP. */ if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) && (fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP) @@ -8440,12 +8441,28 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, /* Allow empty as default value. */ String str,*res; res= fld_default_value->val_str(&str); - if (res->length()) + /* + A default other than '' is always an error, and any non-NULL + specified default is an error in strict mode. + */ + if (res->length() || (thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | + MODE_STRICT_ALL_TABLES))) { my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), fld_name); /* purecov: inspected */ DBUG_RETURN(TRUE); } + else + { + /* + Otherwise a default of '' is just a warning. + */ + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_BLOB_CANT_HAVE_DEFAULT, + ER(ER_BLOB_CANT_HAVE_DEFAULT), + fld_name); + } def= 0; } flags|= BLOB_FLAG; From 34256fb8f59173c82ac5f5fed86662fe1af511c8 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Wed, 19 Jul 2006 14:33:56 -0400 Subject: [PATCH 10/27] Bug #14448: delimiter in 'prompt' "I want to have the current delimiter in the prompt so that I can know at a glance which is set." Add a 'l' format specifier that represents the current statement delimiter. --- client/mysql.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysql.cc b/client/mysql.cc index 94b43d030e8..22534324aca 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3724,6 +3724,9 @@ static const char* construct_prompt() case 't': processed_prompt.append('\t'); break; + case 'l': + processed_prompt.append(delimiter_str); + break; default: processed_prompt.append(c); } From dbb5a408eaf1741823910fb73862a12b58502480 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 20 Jul 2006 17:30:44 +0200 Subject: [PATCH 11/27] Bug#15690 mysqlimport tries to set options the server doesn't understand - "set @@character_set_database" should be ignored by servers prior to 4.1.1 --- client/mysqlimport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 1f9b96f91be..67659684c9c 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -521,7 +521,7 @@ int main(int argc, char **argv) return(1); /* purecov: deadcode */ } - if (mysql_query(sock, "set @@character_set_database=binary;")) + if (mysql_query(sock, "/*!40101 set @@character_set_database=binary */;")) { db_error(sock); /* We shall countinue here, if --force was given */ return(1); From 1c04310e30b77d8dc7cae66fa5ea9b263faca92f Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Sun, 23 Jul 2006 15:25:30 +0500 Subject: [PATCH 12/27] Fix for bug #8143: A date with value 0 is treated as a NULL value --- mysql-test/r/delete.result | 10 ++++++++++ mysql-test/t/delete.test | 11 +++++++++++ sql/sql_delete.cc | 8 ++++++++ 3 files changed, 29 insertions(+) diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 05f1c967e77..0946dc8f809 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -192,3 +192,13 @@ delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; select * from t3; a b drop table t1,t2,t3; +create table t1(a date not null); +insert into t1 values (0); +select * from t1 where a is null; +a +0000-00-00 +delete from t1 where a is null; +select count(*) from t1; +count(*) +0 +drop table t1; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 4284bd2a06d..677ffaa2860 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -171,3 +171,14 @@ delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; # This should be empty select * from t3; drop table t1,t2,t3; + +# +# Bug #8143: deleting '0000-00-00' values using IS NULL +# + +create table t1(a date not null); +insert into t1 values (0); +select * from t1 where a is null; +delete from t1 where a is null; +select count(*) from t1; +drop table t1; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 381d1a71e31..b608773bf6e 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -91,6 +91,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, /* Handler didn't support fast delete; Delete rows one by one */ } + if (conds) + { + Item::cond_result result; + conds= remove_eq_conds(thd, conds, &result); + if (result == Item::COND_FALSE) // Impossible where + limit= 0; + } + table->used_keys.clear_all(); table->quick_keys.clear_all(); // Can't use 'only index' select=make_select(table, 0, 0, conds, 0, &error); From 3aa99c062f7af2b911b32ffcd9fb428220d7a82f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 24 Jul 2006 10:56:33 +0200 Subject: [PATCH 13/27] Bug#10877 mysqldump should use consistent last line - Add printout in write_footer to tell that mysqldump has completed. Ex: -- Dump completed 2006-07-24 8:55:05 --- client/Makefile.am | 4 +++- client/mysqldump.c | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/Makefile.am b/client/Makefile.am index 5787905fd35..b80357f68ea 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -47,7 +47,9 @@ mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix) mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix) mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix) -mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix) +mysqldump_SOURCES= mysqldump.c my_user.c \ + $(top_srcdir)/mysys/mf_getdate.c \ + $(yassl_dummy_link_fix) mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix) mysql_upgrade_SOURCES= mysql_upgrade.c $(yassl_dummy_link_fix) sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc diff --git a/client/mysqldump.c b/client/mysqldump.c index 4318e4b9528..de35358ee42 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -565,6 +565,13 @@ static void write_footer(FILE *sql_file) fprintf(sql_file, "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n"); fputs("\n", sql_file); + if (opt_comments) + { + char time_str[20]; + get_date(time_str, GETDATE_DATE_TIME, 0); + fprintf(sql_file, "-- Dump completed on %s\n", + time_str); + } check_io(sql_file); } } /* write_footer */ From bbf6c985c8979d72ccb314768deb2ed2e71dfa14 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 24 Jul 2006 18:05:00 +0200 Subject: [PATCH 14/27] Bug#20145 perror segfault when call it with error nr - Add test case(execute perror) - Check if strerror has returned NULL and set msg to "Unknown Error" in that case - Thanks to Steven Xie for pointing out how to fix. --- extra/perror.c | 5 ++++- mysql-test/mysql-test-run.pl | 8 ++++++++ mysql-test/r/have_perror.require | 2 ++ mysql-test/r/perror.result | 3 +++ mysql-test/t/perror.test | 11 +++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/have_perror.require create mode 100644 mysql-test/r/perror.result create mode 100644 mysql-test/t/perror.test diff --git a/extra/perror.c b/extra/perror.c index 82311c1b2c9..531d30dae86 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -218,8 +218,11 @@ int main(int argc,char *argv[]) On some system, like NETWARE, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. + + On Solaris 2.8 it might return NULL */ - msg= strerror(10000); + if ((msg= strerror(10000)) == NULL) + msg= "Unknown Error"; /* Allocate a buffer for unknown_error since strerror always returns diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 91a9a758d1d..95ce5dc1bb2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -187,6 +187,7 @@ our $exe_mysqltest; our $exe_slave_mysqld; our $exe_im; our $exe_my_print_defaults; +our $exe_perror; our $lib_udf_example; our $exe_libtool; @@ -1048,6 +1049,8 @@ sub executable_setup () { $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); $exe_my_print_defaults= mtr_exe_exists("$path_client_bindir/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$path_client_bindir/perror"); } else { @@ -1060,6 +1063,8 @@ sub executable_setup () { "$glob_basedir/server-tools/instance-manager/mysqlmanager"); $exe_my_print_defaults= mtr_exe_exists("$glob_basedir/extra/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$glob_basedir/extra/perror"); } if ( $glob_use_embedded_server ) @@ -1107,6 +1112,8 @@ sub executable_setup () { "$glob_basedir/scripts/mysql_fix_privilege_tables"); $exe_my_print_defaults= mtr_exe_exists("$path_client_bindir/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$path_client_bindir/perror"); $path_language= mtr_path_exists("$glob_basedir/share/mysql/english/", "$glob_basedir/share/english/"); @@ -3103,6 +3110,7 @@ sub run_mysqltest ($) { $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; $ENV{'UDF_EXAMPLE_LIB'}= ($lib_udf_example ? basename($lib_udf_example) : ""); + $ENV{'MY_PERROR'}= $exe_perror; $ENV{'NDB_MGM'}= $exe_ndb_mgm; $ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir; diff --git a/mysql-test/r/have_perror.require b/mysql-test/r/have_perror.require new file mode 100644 index 00000000000..260687c87f0 --- /dev/null +++ b/mysql-test/r/have_perror.require @@ -0,0 +1,2 @@ +have_perror +1 diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result new file mode 100644 index 00000000000..6539955bba6 --- /dev/null +++ b/mysql-test/r/perror.result @@ -0,0 +1,3 @@ +MySQL error code 150: Foreign key constraint is incorrectly formed +Is a named type file +Didn't find key on read or update diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test new file mode 100644 index 00000000000..81847f85c96 --- /dev/null +++ b/mysql-test/t/perror.test @@ -0,0 +1,11 @@ +# +# Check if the variable MY_PERROR is set +# +--require r/have_perror.require +disable_query_log; +eval select LENGTH("$MY_PERROR") > 0 as "have_perror"; +enable_query_log; + +--exec $MY_PERROR 150 +--exec $MY_PERROR --silent 120 + From 8f21e375a2b1430726315702f2d856be381d9264 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 24 Jul 2006 19:01:54 +0200 Subject: [PATCH 15/27] Bug #19265 describe command does not work from mysql prompt - Add test case --- mysql-test/r/mysql.result | 10 ++++++++++ mysql-test/t/mysql.test | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 4b7084e813c..164ee4d50ac 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -104,4 +104,14 @@ c_cp932 | 2 | NULL | | 3 | | +------+------+ +create table t1(a int, b varchar(255), c int); +Field Type Null Key Default Extra +a int(11) YES NULL +b varchar(255) YES NULL +c int(11) YES NULL +Field Type Null Key Default Extra +a int(11) YES NULL +b varchar(255) YES NULL +c int(11) YES NULL +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index ac4c323f51e..cfc47a5fbd5 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -77,6 +77,15 @@ drop table t1; # --exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" +# +# Bug#19265 describe command does not work from mysql prompt +# + +create table t1(a int, b varchar(255), c int); +--exec $MYSQL test -e "desc t1" +--exec $MYSQL test -e "desc t1\g" +drop table t1; + --echo End of 5.0 tests From 2bb5f5662f9810112e3d3db3f515f49a8b94102e Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 26 Jul 2006 14:02:24 +0200 Subject: [PATCH 16/27] Bug#19890 mysqltest: "query" command is broken - Allow "query" to be used as a prefix for focing a command to be sent to server - Add testcases --- client/mysqltest.c | 8 ++++++++ mysql-test/r/mysqltest.result | 6 ++++++ mysql-test/t/mysqltest.test | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/client/mysqltest.c b/client/mysqltest.c index 2fc09fbc3d2..a1bc82593c0 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4757,6 +4757,14 @@ int main(int argc, char **argv) q->require_file=require_file; save_file[0]=0; } + /* + To force something being sent as a query to the mysqld one can + use the prefix "query". Remove "query" from string before executing + */ + if (strncmp(q->query, "query ", 6) == 0) + { + q->query= q->first_argument; + } run_query(&cur_con->mysql, q, flags); query_executed= 1; q->last_argument= q->end; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 8055a33ec7d..d9ca863b6bc 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -441,3 +441,9 @@ select-me ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1 drop table t1; drop table t1; +sleep; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1 +sleep; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1 +; +ERROR 42000: Query was empty diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 3968eb519e1..6a0b805f43b 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1125,3 +1125,18 @@ drop table t1; drop table t1; +# +# Bug#19890 mysqltest: "query" command is broken +# + +# It should be possible to use the command "query" to force mysqltest to +# send the command to the server although it's a builtin mysqltest command. +--error 1064 +query sleep; + +--error 1064 +--query sleep + +# Just an empty query command +--error 1065 +query ; From 9e000766b7c22c2de7ff58a6c1ae7bb3abb1709c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 26 Jul 2006 14:09:20 +0200 Subject: [PATCH 17/27] Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror - Since error 1186 is not found among NDB error codes, the message retuned should indicate that. --- extra/perror.c | 27 ++++++++++++++------------ mysql-test/t/perror.test | 11 +++++++++++ ndb/src/kernel/error/ndbd_exit_codes.c | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/extra/perror.c b/extra/perror.c index 531d30dae86..b26e516a101 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -261,7 +261,7 @@ int main(int argc,char *argv[]) found= 1; msg= 0; } - else + else #endif msg = strerror(code); @@ -281,20 +281,23 @@ int main(int argc,char *argv[]) else puts(msg); } - if (!(msg=get_ha_error_msg(code))) + + if (!found) { - if (!found) - { + /* Error message still not found, look in handler error codes */ + if (!(msg=get_ha_error_msg(code))) + { fprintf(stderr,"Illegal error code: %d\n",code); error=1; - } - } - else - { - if (verbose) - printf("MySQL error code %3d: %s\n",code,msg); - else - puts(msg); + } + else + { + found= 1; + if (verbose) + printf("MySQL error code %3d: %s\n",code,msg); + else + puts(msg); + } } } } diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test index 81847f85c96..63f2301f18e 100644 --- a/mysql-test/t/perror.test +++ b/mysql-test/t/perror.test @@ -9,3 +9,14 @@ enable_query_log; --exec $MY_PERROR 150 --exec $MY_PERROR --silent 120 +# +# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror +# + +# As long there is no error code 1186 defined by NDB +# we should get a message "Illegal ndb error code: 1186" +--error 1 +--exec $MY_PERROR --ndb 1186 + +# As there is an error code defined for 1186, expect error +--exec $MY_PERROR 1186 diff --git a/ndb/src/kernel/error/ndbd_exit_codes.c b/ndb/src/kernel/error/ndbd_exit_codes.c index 07b276346a0..cb3272b38a9 100644 --- a/ndb/src/kernel/error/ndbd_exit_codes.c +++ b/ndb/src/kernel/error/ndbd_exit_codes.c @@ -247,7 +247,7 @@ int ndbd_exit_string(int err_no, char *str, unsigned int size) ndbd_exit_classification cl; ndbd_exit_status st; const char *msg = ndbd_exit_message(err_no, &cl); - if (msg[0] != '\0') + if (msg[0] != '\0' && cl != XUE) { const char *cl_msg = ndbd_exit_classification_message(cl, &st); const char *st_msg = ndbd_exit_status_message(st); From 7e8cfe3830f6a0ffa1993c1ac79b8507589dfae5 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 26 Jul 2006 14:21:40 +0200 Subject: [PATCH 18/27] Update test result for perror --- mysql-test/r/perror.result | 5 ++--- mysql-test/t/perror.test | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index 6539955bba6..a26bdb0e068 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -1,3 +1,2 @@ -MySQL error code 150: Foreign key constraint is incorrectly formed -Is a named type file -Didn't find key on read or update +Illegal ndb error code: 1186 +Illegal error code: 1186 diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test index 63f2301f18e..e6c9546161b 100644 --- a/mysql-test/t/perror.test +++ b/mysql-test/t/perror.test @@ -6,8 +6,8 @@ disable_query_log; eval select LENGTH("$MY_PERROR") > 0 as "have_perror"; enable_query_log; ---exec $MY_PERROR 150 ---exec $MY_PERROR --silent 120 +--exec $MY_PERROR 150 > /dev/null +--exec $MY_PERROR --silent 120 > /dev/null # # Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror @@ -16,7 +16,8 @@ enable_query_log; # As long there is no error code 1186 defined by NDB # we should get a message "Illegal ndb error code: 1186" --error 1 ---exec $MY_PERROR --ndb 1186 +--exec $MY_PERROR --ndb 1186 2>&1 # As there is an error code defined for 1186, expect error ---exec $MY_PERROR 1186 +--error 1 +--exec $MY_PERROR 1186 2>&1 From b3bbb3789e2bcac169b9a20ca33f15c2d341a734 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 27 Jul 2006 12:28:49 +0200 Subject: [PATCH 19/27] Bug#21042 mysql client segfaults on importing a mysqldump export - Use strxnmov to protect the "buff" variable from overrun --- client/mysql.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index 22534324aca..5c0b5ce04fe 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2858,7 +2858,7 @@ com_connect(String *buffer, char *line) bzero(buff, sizeof(buff)); if (buffer) { - strmov(buff, line); + strxnmov(buff, sizeof(buff), line, NullS); tmp= get_arg(buff, 0); if (tmp && *tmp) { From 61a3a8e95cef229113fab2f2381338315e8b4a2a Mon Sep 17 00:00:00 2001 From: "igreenhoe/greenman@anubis.greendragongames.com" <> Date: Fri, 28 Jul 2006 20:51:17 -0700 Subject: [PATCH 20/27] Fix for bug #16226 (timestamp_diff truncation issue when requesting difference between timestamp in values of months and quarters.) Problem: when requesting timestamp diff in months or quarters, it would only examine the date (and not the time) for the comparison. Solution: increased precision of comparison. --- mysql-test/r/func_time.result | 72 +++++++++++++++++++++++++++++++++++ mysql-test/t/func_time.test | 31 +++++++++++++++ sql/item_timefunc.cc | 15 ++++++++ 3 files changed, 118 insertions(+) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 66fe355ffce..699f0c9ec4b 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -667,6 +667,78 @@ timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3, timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4; a1 a2 a3 a4 28 28 29 29 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27') +0 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28') +1 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29') +1 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27') +1 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28') +2 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29'); +TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29') +2 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27') +0 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28') +1 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29') +1 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27') +1 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28') +2 +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29'); +TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29') +2 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27') +0 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28') +1 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29') +1 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27') +1 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28') +2 +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29'); +TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29') +2 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27') +0 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28') +1 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29') +1 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27') +1 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28') +2 +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29'); +TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29') +2 select date_add(time,INTERVAL 1 SECOND) from t1; date_add(time,INTERVAL 1 SECOND) NULL diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 188e5667009..83b877e725c 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -318,6 +318,37 @@ select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3, timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4; +# bug 16226 +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27'); +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28'); +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29'); +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27'); +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28'); +SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29'); + +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27'); +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28'); +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29'); +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27'); +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28'); +SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29'); + +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27'); +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28'); +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29'); +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27'); +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28'); +SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29'); + +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27'); +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28'); +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29'); +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27'); +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28'); +SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29'); + +# end of bug + select date_add(time,INTERVAL 1 SECOND) from t1; drop table t1; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 9e1962835c8..835be6554bc 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2877,6 +2877,8 @@ longlong Item_func_timestamp_diff::val_int() { uint year_beg, year_end, month_beg, month_end, day_beg, day_end; uint years= 0; + uint second_beg, second_end, microsecond_beg, microsecond_end; + if (neg == -1) { year_beg= ltime2.year; @@ -2885,6 +2887,10 @@ longlong Item_func_timestamp_diff::val_int() month_end= ltime1.month; day_beg= ltime2.day; day_end= ltime1.day; + second_beg= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second; + second_end= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second; + microsecond_beg= ltime2.second_part; + microsecond_end= ltime1.second_part; } else { @@ -2894,6 +2900,10 @@ longlong Item_func_timestamp_diff::val_int() month_end= ltime2.month; day_beg= ltime1.day; day_end= ltime2.day; + second_beg= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second; + second_end= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second; + microsecond_beg= ltime1.second_part; + microsecond_end= ltime2.second_part; } /* calc years */ @@ -2907,8 +2917,13 @@ longlong Item_func_timestamp_diff::val_int() months+= 12 - (month_beg - month_end); else months+= (month_end - month_beg); + if (day_end < day_beg) months-= 1; + else if ((day_end == day_beg) && + ((second_end < second_beg) || + (second_end == second_beg && microsecond_end < microsecond_beg))) + months-= 1; } switch (int_type) { From eaae3b2d2b847e9185e931f6334083d3f076bc83 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Sun, 30 Jul 2006 19:30:20 +0200 Subject: [PATCH 21/27] BUG#21217 "mysqltest" client is inconsistent when to log a line number - Init start_lineno to 0 --- client/mysqltest.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 3f2e7d8edb6..ad0f9f857bb 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -147,7 +147,7 @@ const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./"; static int port = 0; static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0; static my_bool tty_password= 0, ps_protocol= 0, ps_protocol_enabled= 0; -static uint start_lineno, *lineno; +static uint start_lineno= 0, *lineno; const char *manager_user="root",*manager_host=0; char *manager_pass=0; int manager_port=MYSQL_MANAGER_PORT; @@ -580,7 +580,7 @@ static void die(const char *fmt, ...) if (cur_file && cur_file != file_stack) fprintf(stderr, "In included file \"%s\": ", cur_file->file_name); - if (start_lineno != 0) + if (start_lineno > 0) fprintf(stderr, "At line %u: ", start_lineno); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); @@ -4072,6 +4072,8 @@ int main(int argc, char **argv) parser.current_line += current_line_inc; } + start_lineno= 0; + if (!query_executed && result_file && my_stat(result_file, &res_info, 0)) { /* From a5112188e2a7dd85ff8bae01133e044f5b108fa0 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 31 Jul 2006 12:47:56 +0200 Subject: [PATCH 22/27] Fix lowercase_fs_off problem on windows. This test should not be run if lower_case_filesystem=OFF. By default lowercase_table_names are 1 on windows, and that makes the initialization of lower_case_filesystem variable to be skipped. Add an else bracnh that does the initialization. --- sql/mysqld.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 429bdee17d6..b5b6ac1449f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2770,6 +2770,11 @@ You should consider changing lower_case_table_names to 1 or 2", mysql_real_data_home); lower_case_table_names= 0; } + else + { + lower_case_file_system= + (test_if_case_insensitive(mysql_real_data_home) == 1); + } /* Reset table_alias_charset, now that lower_case_table_names is set. */ table_alias_charset= (lower_case_table_names ? From 823ead0775f70253a7a85d38fc2812ae4ba920bd Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 31 Jul 2006 13:11:21 +0200 Subject: [PATCH 23/27] perror returns 2 if it does not understand the option --ndb Move that perror test to ndb_basic so it's only run when there is support for --ndb --- mysql-test/r/ndb_basic.result | 1 + mysql-test/r/perror.result | 1 - mysql-test/t/ndb_basic.test | 10 ++++++++++ mysql-test/t/perror.test | 5 ----- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 09c4f9b29f9..d2111db24fe 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -748,3 +748,4 @@ f1 f2 f3 111111 aaaaaa 1 222222 bbbbbb 2 drop table t1; +Illegal ndb error code: 1186 diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index a26bdb0e068..05639197391 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -1,2 +1 @@ -Illegal ndb error code: 1186 Illegal error code: 1186 diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index 5d79d5eb9f9..6c1a4e44f4b 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -700,3 +700,13 @@ select * from t1 order by f1; select * from t1 order by f2; select * from t1 order by f3; drop table t1; + +# +# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror +# + +# As long there is no error code 1186 defined by NDB +# we should get a message "Illegal ndb error code: 1186" +--error 1 +--exec $MY_PERROR --ndb 1186 2>&1 + diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test index e6c9546161b..21297fccd95 100644 --- a/mysql-test/t/perror.test +++ b/mysql-test/t/perror.test @@ -13,11 +13,6 @@ enable_query_log; # Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror # -# As long there is no error code 1186 defined by NDB -# we should get a message "Illegal ndb error code: 1186" ---error 1 ---exec $MY_PERROR --ndb 1186 2>&1 - # As there is an error code defined for 1186, expect error --error 1 --exec $MY_PERROR 1186 2>&1 From 2461e48698b6d2ce223597cd1ddaf0ee83a8ebd6 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 31 Jul 2006 14:22:32 +0200 Subject: [PATCH 24/27] Bug#21042 mysql client segfaults on importing a mysqldump export - Use strmake, that will both protect the buffer and make sure it's terminated by a zero - Add test case --- client/mysql.cc | 2 +- mysql-test/r/mysql.result | 1 + mysql-test/t/mysql.test | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index 5c0b5ce04fe..25faf91b25d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2858,7 +2858,7 @@ com_connect(String *buffer, char *line) bzero(buff, sizeof(buff)); if (buffer) { - strxnmov(buff, sizeof(buff), line, NullS); + strmake(buff, line, sizeof(buff)); tmp= get_arg(buff, 0); if (tmp && *tmp) { diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 164ee4d50ac..55ed2a4868b 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -114,4 +114,5 @@ a int(11) YES NULL b varchar(255) YES NULL c int(11) YES NULL drop table t1; +ERROR 1049 (42000) at line 1: Unknown database 'verylongdatabasenamethatshouldblowthe256byteslongbufferincom_con' End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index cfc47a5fbd5..10c07c931ab 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -86,6 +86,12 @@ create table t1(a int, b varchar(255), c int); --exec $MYSQL test -e "desc t1\g" drop table t1; +# +# Bug#21042 mysql client segfaults on importing a mysqldump export +# +--error 1 +--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1 + --echo End of 5.0 tests From e9b624df99bb59393216cd8fcc485419c3b1d883 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 1 Aug 2006 11:29:10 +0200 Subject: [PATCH 25/27] Change error code to test for "unknown error" with to 10000 --- mysql-test/r/perror.result | 2 +- mysql-test/t/perror.test | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index 05639197391..4946523bc42 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -1 +1 @@ -Illegal error code: 1186 +Illegal error code: 10000 diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test index 21297fccd95..a4b99d8aa22 100644 --- a/mysql-test/t/perror.test +++ b/mysql-test/t/perror.test @@ -13,6 +13,7 @@ enable_query_log; # Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror # -# As there is an error code defined for 1186, expect error +# Test with error code 10000 as it's a common "unknown error" +# As there is no error code defined for 10000, expect error --error 1 ---exec $MY_PERROR 1186 2>&1 +--exec $MY_PERROR 10000 2>&1 From 111513f09f581c9400956d27b3041714eb6ac130 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 1 Aug 2006 11:35:37 +0200 Subject: [PATCH 26/27] Bug#21367 IM tests do not recognize "win2003-amd64" as Windows - Disable Instance manager on Windows --- mysql-test/mysql-test-run.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 95ce5dc1bb2..d8ab940fdca 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -812,6 +812,13 @@ sub command_line_setup () { $opt_with_ndbcluster= 0; } + # Check IM arguments + if ( $glob_win32 ) + { + mtr_report("Disable Instance manager - not supported on Windows"); + opt_skip_im= 1; + } + # Check valgrind arguments if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options) { From c1f0f4dc587b1ce8a1ee876de8e0ac70511c20f9 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 1 Aug 2006 15:21:09 +0200 Subject: [PATCH 27/27] Add missing $ --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d8ab940fdca..f029924e292 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -816,7 +816,7 @@ sub command_line_setup () { if ( $glob_win32 ) { mtr_report("Disable Instance manager - not supported on Windows"); - opt_skip_im= 1; + $opt_skip_im= 1; } # Check valgrind arguments