summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2008-10-10 15:13:12 +0500
committerGleb Shchepa <gshchepa@mysql.com>2008-10-10 15:13:12 +0500
commite7520c4b7ea7f4303f250636c37133be8237a2ac (patch)
tree2efe1de3ae86c64e7cf0f0a286c7979d507d7d64 /sql/sql_select.cc
parentc3d3f3ecf4cf0b6f2f8813695bb29a9e6aa7c0e6 (diff)
downloadmariadb-git-e7520c4b7ea7f4303f250636c37133be8237a2ac.tar.gz
Bug #39283: Date returned as VARBINARY to client for queries
with COALESCE and JOIN The server returned to a client the VARBINARY column type instead of the DATE type for a result of the COALESCE, IFNULL, IF, CASE, GREATEST or LEAST functions if that result was filesorted in an anonymous temporary table during the query execution. For example: SELECT COALESCE(t1.date1, t2.date2) AS result FROM t1 JOIN t2 ON t1.id = t2.id ORDER BY result; To create a column of various date/time types in a temporary table the create_tmp_field_from_item() function uses the Item::tmp_table_field_from_field_type() method call. However, fields of the MYSQL_TYPE_NEWDATE type were missed there, and the VARBINARY columns were created by default. Necessary condition has been added.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6928effc1a5..7ff069f0996 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8964,6 +8964,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
*/
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE ||
+ type == MYSQL_TYPE_NEWDATE ||
type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_GEOMETRY)
new_field= item->tmp_table_field_from_field_type(table);
/*