A cleanup for MDEV-9217 Split Item::tmp_table_field_from_field_type() into...
A cleanup for MDEV-9217 Split Item::tmp_table_field_from_field_type() into virtual methods in Type_handler Fixing that the server tried to create the old decimal for: CREATE TABLE t2 AS SELECT old_decimal_field FROM t1 UNION SELECT bigint_field FROM t1; CREATE TABLE t2 AS SELECT old_decimal_field FROM t1 UNION SELECT mediumint_field FROM t1; CREATE TABLE t2 AS SELECT year FROM t1 UNION SELECT old_decimal_field FROM t1; CREATE TABLE t2 AS SELCT COALESCE(old_decimal_field) FROM t1; Solution: 1. field_types_merge_rules[][] had three MYSQL_TYPE_DECIMAL remainders. Fixing to MYSQL_TYPE_NEWDECIMAL, like it is done for all other type pairs. This fixes the above queries with UNION. 2. Convert MYSQL_TYPE_DECIMAL to MYSQL_TYPE_NEWDECIMAL in Item::tmp_table_field_from_field_type(). This fixed the above query with COALESCE. 3. Adding "new Field_decimal" into Type_handler_olddecimal::make_table_field(). In case if something goes wrong it will crash on assert only in debug builds, while create the old decimal in release. Note, this "new Field_decimal" will be needed later anyway, when we reuse Type_handler::make_table_field() in make_field() in field.cc.
Showing
Please register or sign in to comment