From 06fb78c6acf0cf22ab756e5b89652aa6a5e8485e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 18 May 2020 11:29:43 +0400 Subject: MDEV-21995 Server crashes in Item_field::real_type_handler with table value constructor 1. Code simplification: Item_default_value handled all these values: a. DEFAULT(field) b. DEFAULT c. IGNORE and had various conditions to distinguish (a) from (b) and from (c). Introducing a new abstract class Item_contextually_typed_value_specification, to handle (b) and (c), so the hierarchy now looks as follows: Item Item_result_field Item_ident Item_field Item_default_value - DEFAULT(field) Item_contextually_typed_value_specification Item_default_specification - DEFAULT Item_ignore_specification - IGNORE 2. Introducing a new virtual method is_evaluable_expression() to determine if an Item is: - a normal expression, so its val_xxx()/get_date() methods can be called - or a just an expression substitute, whose value methods cannot be called. 3. Disallowing Items that are not evalualble expressions in table value constructors. --- mysql-test/main/table_value_constr.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mysql-test/main/table_value_constr.test') diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index e7843c604dd..11d553f0b85 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1339,3 +1339,17 @@ BEGIN NOT ATOMIC END; $$ DELIMITER ;$$ + + +--echo # +--echo # MDEV-21995 Server crashes in Item_field::real_type_handler with table value constructor +--echo # + +--error ER_UNKNOWN_ERROR +VALUES (IGNORE); +--error ER_UNKNOWN_ERROR +VALUES (DEFAULT); +--error ER_UNKNOWN_ERROR +EXECUTE IMMEDIATE 'VALUES (?)' USING IGNORE; +--error ER_UNKNOWN_ERROR +EXECUTE IMMEDIATE 'VALUES (?)' USING DEFAULT; -- cgit v1.2.1