mirror of https://github.com/MariaDB/server
Browse Source
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'bb-11.4-bar-m35677
3 changed files with 36 additions and 2 deletions
Loading…
Reference in new issue