summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi4
-rw-r--r--mysql-test/r/create.result5
-rw-r--r--mysql-test/t/create.test3
-rw-r--r--sql/item_func.cc2
4 files changed, 13 insertions, 1 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 3e5c15566b8..1609444ad16 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -50364,6 +50364,10 @@ each individual 4.0.x release.
@itemize @bullet
@item
+Fixed a bug in guessing a field type out of the function. The error was
+introduced in 4.0.3 so that field type depended on the first argument to
+the function instead of the function itself
+@item
Fixed a bug with wildcarded fields in select list, which led to the wrong
number of elements in a list containing all fields
@item
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 71044065dad..1e832a128e2 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -136,3 +136,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
+create table t1 select if('2002'='2002','Y','N');
+select * from t1;
+if('2002'='2002','Y','N')
+Y
+drop table if exists t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 7e924e9f262..bb0d6dc0d64 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -91,3 +91,6 @@ show create table t1;
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
+create table t1 select if('2002'='2002','Y','N');
+select * from t1;
+drop table if exists t1;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 8b05109b289..1bf94ae75d0 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -173,7 +173,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
if (!t_arg)
return result_field;
- switch (args[0]->result_type()) {
+ switch (result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,