From e6f96b49396edcc85e97e5eebb43f8a9e13bb994 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Mon, 8 Aug 2005 19:09:54 +0500 Subject: [PATCH 1/2] func_system.result, func_system.test: adding test case item_strfunc.cc: Bug#12351 CONCAT with USER()/DATEBASE() and a column gets strange results. Mark created Item_str as constant, so CONCAT cannot reuse it for optimization purposes. --- mysql-test/r/func_system.result | 15 +++++++++++++++ mysql-test/t/func_system.test | 12 ++++++++++++ sql/item_strfunc.cc | 1 + 3 files changed, 28 insertions(+) diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result index 137c25a2db5..d49da90fa28 100644 --- a/mysql-test/r/func_system.result +++ b/mysql-test/r/func_system.result @@ -68,6 +68,21 @@ drop table t1; select TRUE,FALSE,NULL; TRUE FALSE NULL 1 0 NULL +create table t1 (c1 char(5)) character set=latin1; +insert into t1 values('row 1'); +insert into t1 values('row 2'); +insert into t1 values('row 3'); +select concat(user(), '--', c1) from t1; +concat(user(), '--', c1) +root@localhost--row 1 +root@localhost--row 2 +root@localhost--row 3 +select concat(database(), '--', c1) from t1; +concat(database(), '--', c1) +test--row 1 +test--row 2 +test--row 3 +drop table t1; create table t1 (a char(10)) character set latin1; select * from t1 where a=version(); a diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test index d7e215f5d48..4a526935491 100644 --- a/mysql-test/t/func_system.test +++ b/mysql-test/t/func_system.test @@ -31,6 +31,18 @@ drop table t1; select TRUE,FALSE,NULL; +# +# Bug#12351: CONCAT with USER()/DATEBASE() and +# a constant and a column gets strange results +# +create table t1 (c1 char(5)) character set=latin1; +insert into t1 values('row 1'); +insert into t1 values('row 2'); +insert into t1 values('row 3'); +select concat(user(), '--', c1) from t1; +select concat(database(), '--', c1) from t1; +drop table t1; + # # Bug#8291 Illegal collation mix with USER() function # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d316c7eaf72..7a66a57c84b 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1550,6 +1550,7 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs) return NULL; } conv->str_value.copy(); + conv->str_value.shrink_to_length(); return conv; } From 8c83f14b762bf0923727a7d4804b3ffb267f4428 Mon Sep 17 00:00:00 2001 From: "patg@radha.local" <> Date: Wed, 10 Aug 2005 23:37:17 +0200 Subject: [PATCH 2/2] BUG #12253. Fixed logic the prevented repair when "--fast" was included in invoking mysqlcheck. --- client/mysqlcheck.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 07f3f25b50c..ee99d359000 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -575,8 +575,13 @@ static void print_result() if (status) { + /* + if there was an error with the table, we have --auto-repair set, + and this isn't a repair op, then add the table to the tables4repair + list + */ if (found_error && opt_auto_repair && what_to_do != DO_REPAIR && - (!opt_fast || strcmp(row[3],"OK"))) + strcmp(row[3],"OK")) insert_dynamic(&tables4repair, prev); found_error=0; if (opt_silent) @@ -595,8 +600,8 @@ static void print_result() strmov(prev, row[0]); putchar('\n'); } - if (found_error && opt_auto_repair && what_to_do != DO_REPAIR && - !opt_fast) + /* add the last table to be repaired to the list */ + if (found_error && opt_auto_repair && what_to_do != DO_REPAIR) insert_dynamic(&tables4repair, prev); mysql_free_result(res); }