-
Roy Lyseng authored
Bug#15936817: Table left join view, unmatched rows problem where view has an if Bug#15967464: View evaluation incorrect when joining to view with literal Bug#20708288: Literal selected from derived table mentioned in outer join ..null Bug#20841369: Left join to view with <> test causing too many results This problem may occur for views and derived tables that are on the inner side of an outer join and from which we select non-nullable expressions such as literals. If the current row being produced by the executor contains null-extended values from the inner table(s), the non-nullable expressions are not presented with NULL values as they should. When field translations are created for a derived table or view reference, we simply set item->maybe_null= true for all fields from the inner side of an outer join. But for some field types, such as literals, this does not make sense, because evaluating such fields can never produce a NULL value. The solution to the problem is to extend the functionality of class Item_direct_view_ref. All columns selected from a view are wrapped in such Item objects. We enhance this class by making nullability depending on being on the inner side of an outer join, and being able to take NULL value from a null-extended row. Tests are added for these Item types, which all can be non-nullable unless they are selected from the inner side of an outer join. - literals - IS [NOT] NULL - IS [NOT] TRUE - IS [NOT] FALSE - IS [NOT] UNKNOWN - IF - CASE - COALESCE - NULLIF - IFNULL - IF A bug in nullability detection for CASE expressions was discovered during debugging and fixed. An unused constructor for class Item_direct_view_ref was deleted.
Roy Lyseng authoredBug#15936817: Table left join view, unmatched rows problem where view has an if Bug#15967464: View evaluation incorrect when joining to view with literal Bug#20708288: Literal selected from derived table mentioned in outer join ..null Bug#20841369: Left join to view with <> test causing too many results This problem may occur for views and derived tables that are on the inner side of an outer join and from which we select non-nullable expressions such as literals. If the current row being produced by the executor contains null-extended values from the inner table(s), the non-nullable expressions are not presented with NULL values as they should. When field translations are created for a derived table or view reference, we simply set item->maybe_null= true for all fields from the inner side of an outer join. But for some field types, such as literals, this does not make sense, because evaluating such fields can never produce a NULL value. The solution to the problem is to extend the functionality of class Item_direct_view_ref. All columns selected from a view are wrapped in such Item objects. We enhance this class by making nullability depending on being on the inner side of an outer join, and being able to take NULL value from a null-extended row. Tests are added for these Item types, which all can be non-nullable unless they are selected from the inner side of an outer join. - literals - IS [NOT] NULL - IS [NOT] TRUE - IS [NOT] FALSE - IS [NOT] UNKNOWN - IF - CASE - COALESCE - NULLIF - IFNULL - IF A bug in nullability detection for CASE expressions was discovered during debugging and fixed. An unused constructor for class Item_direct_view_ref was deleted.
Loading