Skip to content
Permalink
Browse files
MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_int
    This bug is caused by pushdown from HAVING into WHERE.
    It appears because condition that is pushed wasn't fixed.

    It is also discovered that condition pushdown from HAVING into
    WHERE is done wrong. There is no need to build clones for some
    conditions that can be pushed. They can be simply moved from HAVING
    into WHERE without cloning.
    build_pushable_cond_for_having_pushdown(),
    remove_pushed_top_conjuncts_for_having() methods are changed.

    It is found that there is no transformation made for fields of
    pushed condition.
    field_transformer_for_having_pushdown transformer is added.

    New tests are added. Some comments are changed.
  • Loading branch information
shagalla committed Apr 4, 2019
1 parent 3a3d5ba commit ae15f91
Show file tree
Hide file tree
Showing 18 changed files with 4,180 additions and 586 deletions.
@@ -8218,39 +8218,18 @@ EXPLAIN
"query_block": {
"select_id": 1,
"table": {
"table_name": "<subquery2>",
"access_type": "system",
"rows": 1,
"filtered": 100,
"materialized": {
"unique": 1,
"message": "Impossible WHERE"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"message": "Impossible WHERE"
}
}
}
},
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v1.c = NULL",
"materialized": {
"query_block": {
"select_id": 3,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t1.c = NULL"
}
}
}
}
]
}
}
DROP VIEW v1;
@@ -483,7 +483,7 @@ HAVING (table2.f2 = 8);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where 0 group by `test`.`table1`.`f1`,7 having multiple equal(8, 7)
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where 0 group by `test`.`table1`.`f1`,7 having 1
DROP TABLE t1;
#
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355

0 comments on commit ae15f91

Please sign in to comment.