mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-35677 Assertion `thd->is_error()' failed in virtual bool Field::sp_prepare_and_store_item(THD*, Item**)
The Count_handler (derived from Internal_error_handler) used in Type_handler_datetime_common::convert_item_for_comparison() suppressed all error codes. This caused a DBUG_ASSERT(thd->is_error()) in Field::sp_prepare_and_store_item() when the error happened while evaluating a subselect in a scenario like this: CREATE FUNCTION f() RETURNS INT DETERMINISTIC RETURN (SELECT a FROM t); CREATE TABLE t (c TIMESTAMP); SELECT * FROM t WHERE c=f(); Notice there is no such column 'a' in in the table 't'. Fix: Handle only DATETIME->TIMESTAMP conversion related errors in Count_handler: - ER_TRUNCATED_WRONG_VALUE - ER_DATETIME_FUNCTION_OVERFLOW thus let other error kinds be processed in their usual way. The reported scenario now returns this (expected) error: ERROR 1054 (42S22): Unknown column 'a' in 'SELECT'
This commit is contained in:
@ -7959,8 +7959,13 @@ Type_handler_datetime_common::convert_item_for_comparison(
|
||||
const char *msg,
|
||||
Sql_condition **cond_hdl) override
|
||||
{
|
||||
hit++;
|
||||
return *level >= Sql_condition::WARN_LEVEL_WARN;
|
||||
if (sql_errno == ER_TRUNCATED_WRONG_VALUE ||
|
||||
sql_errno == ER_DATETIME_FUNCTION_OVERFLOW)
|
||||
{
|
||||
hit++;
|
||||
return *level >= Sql_condition::WARN_LEVEL_WARN;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} cnt_handler;
|
||||
|
||||
|
Reference in New Issue
Block a user