Bug #95794 failed assertion when trying to create a column with timestamp value
Submitted: 13 Jun 2019 15:56 Modified: 20 Aug 2019 17:56
Reporter: Martin Hansson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S2 (Serious)
Version:8.0.18 OS:Any
Assigned to: CPU Architecture:Any

[13 Jun 2019 15:56] Martin Hansson
Description:
Trying to use a standard SQL timestamp literal as the default column value causes the server to crash.

The following is printed:
mysqld: ../../sql/sql_parse.cc:5403: bool Alter_info::add_field(THD*, const LEX_STRING*, enum_field_types, const char*, const char*, uint, Item*, Item*, LEX_CSTRING*, const char*, List<String>*, const CHARSET_INFO*, bool, uint, Value_generator*, Value_generator*, const char*, Mysql::Nullable<unsigned int>, Sql_check_constraint_spec_list*, dd::Column::enum_hidden_type, bool): Assertion `dynamic_cast<Item_func_true *>(func) || dynamic_cast<Item_func_false *>(func)' failed.

How to repeat:
CREATE TABLE t1 ( a TIMESTAMP DEFAULT TIMESTAMP'2019-10-01 01:02:03' );
CREATE TABLE t1 ( a DATETIME DEFAULT TIMESTAMP'2019-10-01 01:02:03' );
CREATE TABLE t1 ( a INT DEFAULT TIMESTAMP'2019-10-01 01:02:03' );
...and so on...
[20 Aug 2019 17:56] Paul DuBois
Posted by developer:
 
Fixed in 8.0.19.

Incorrect checking of temporal literals for CREATE TABLE statements
could lead to a server exit.