summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-06-08 19:04:12 +0400
committerAlexander Barkov <bar@mariadb.org>2016-06-08 19:04:12 +0400
commita4848e975d2fe359ff354e767427c01dbe908037 (patch)
treeb48321980f990fab4e40e84f700237790bd7abd0 /sql/item_func.cc
parentb31976f5233ac2d3fb909dafeaca0799162c2f9d (diff)
downloadmariadb-git-a4848e975d2fe359ff354e767427c01dbe908037.tar.gz
MDEV-9972 Least function retuns date in date time format
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index cabba7a666c..4b5f96cd3e7 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2939,12 +2939,13 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
}
unpack_time(min_max, ltime);
- if (compare_as_dates->field_type() == MYSQL_TYPE_DATE)
+ enum_field_types ftype= compare_as_dates->field_type();
+ if (ftype == MYSQL_TYPE_DATE || ftype == MYSQL_TYPE_NEWDATE)
{
ltime->time_type= MYSQL_TIMESTAMP_DATE;
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
}
- else if (compare_as_dates->field_type() == MYSQL_TYPE_TIME)
+ else if (ftype == MYSQL_TYPE_TIME)
{
ltime->time_type= MYSQL_TIMESTAMP_TIME;
ltime->hour+= (ltime->month * 32 + ltime->day) * 24;