1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-15262 Wrong results for SELECT..WHERE non_indexed_datetime_column=indexed_time_column

This commit is contained in:
Alexander Barkov
2018-02-09 19:47:00 +04:00
parent 6f0b316fbe
commit b0a92333c0
3 changed files with 74 additions and 0 deletions

View File

@ -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;
}