diff options
author | Alexander Barkov <bar@mariadb.org> | 2018-02-09 19:47:00 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-02-09 19:47:00 +0400 |
commit | b0a92333c00f8facd20c55cf7a8dfaf896b7f24d (patch) | |
tree | ad266508acfbc799cb6f8e4d25bed4cdd19de6e4 /sql/field.cc | |
parent | 6f0b316fbe83d2cf555f867dda262896d18fbbf6 (diff) | |
download | mariadb-git-b0a92333c00f8facd20c55cf7a8dfaf896b7f24d.tar.gz |
MDEV-15262 Wrong results for SELECT..WHERE non_indexed_datetime_column=indexed_time_column
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index c36fff06a07..a9a7d54929b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5330,6 +5330,13 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days) ltime->second) * 1000000LL + ltime->second_part); unpack_time(timediff, ltime); + /* + unpack_time() broke down hours into ltime members hour,day,month. + Mix them back to ltime->hour using the same factors + that pack_time()/unpack_time() use (i.e. 32 for month). + */ + ltime->hour+= (ltime->month * 32 + ltime->day) * 24; + ltime->month= ltime->day= 0; } ltime->time_type= MYSQL_TIMESTAMP_TIME; } |