summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-08-12 15:44:03 +0500
committerunknown <bar@mysql.com>2005-08-12 15:44:03 +0500
commit058d5bff6e73eb4b9b36cb0bb82687557e3c317d (patch)
treed8d0351d83f852b706b4081edfabb852a0522032
parentd8ab9304989108eeef77e5331d62bfe2c0d9f8a8 (diff)
parentd3a6f4082fa5c50881b4344a23d157f8c3c5009d (diff)
downloadmariadb-git-058d5bff6e73eb4b9b36cb0bb82687557e3c317d.tar.gz
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/bar/mysql-4.1.b12351 sql/item_strfunc.cc: Auto merged
-rw-r--r--mysql-test/r/func_system.result15
-rw-r--r--mysql-test/t/func_system.test12
-rw-r--r--sql/item_strfunc.cc1
3 files changed, 28 insertions, 0 deletions
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
@@ -32,6 +32,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
#
create table t1 (a char(10)) character set latin1;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b7015b3d6ef..d0650a1ce11 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1562,6 +1562,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;
}