MDEV-23562 Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed upon SELECT from versioned table
The code in vers_select_conds_t::init_from_sysvar() assumed that the value of the system_versioning_asof is DATETIME. But it also could be DATE after a query like this: SET system_versioning_asof = DATE(NOW()); Fixing Sys_var_vers_asof::update() to convert the value of the assignment source to DATETIME if it returned DATE. Now vers_select_conds_t::init_from_sysvar() always gets a DATETIME value.
This commit is contained in:
parent
056766c042
commit
329301d2e6
@ -186,4 +186,13 @@ SELECT @@global.system_versioning_asof;
|
||||
@@global.system_versioning_asof
|
||||
2002-01-01 00:00:00.000000
|
||||
SET @@global.system_versioning_asof= DEFAULT;
|
||||
#
|
||||
# MDEV-23562 Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed upon SELECT from versioned table
|
||||
#
|
||||
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
|
||||
SET system_versioning_asof= DATE(NOW());
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
SET system_versioning_asof= DEFAULT;
|
||||
# End of 10.4 tests
|
||||
|
@ -138,4 +138,14 @@ SET @@global.system_versioning_asof= timestamp'2001-12-31 23:59:59.9999999';
|
||||
SELECT @@global.system_versioning_asof;
|
||||
SET @@global.system_versioning_asof= DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23562 Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed upon SELECT from versioned table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
|
||||
SET system_versioning_asof= DATE(NOW());
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET system_versioning_asof= DEFAULT;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
@ -2669,7 +2669,11 @@ private:
|
||||
Datetime::Options opt(TIME_CONV_NONE |
|
||||
TIME_NO_ZERO_IN_DATE |
|
||||
TIME_NO_ZERO_DATE, thd);
|
||||
res= var->value->get_date(thd, &out.ltime, opt);
|
||||
/*
|
||||
var->value is allowed to return DATETIME and DATE
|
||||
Make sure to convert DATE to DATETIME.
|
||||
*/
|
||||
res= Datetime(thd, var->value, opt).copy_to_mysql_time(&out.ltime);
|
||||
}
|
||||
else // set DEFAULT from global var
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user