Bug #86922 | Outer join optimized away with user-defined functions | ||
---|---|---|---|
Submitted: | 4 Jul 2017 10:31 | Modified: | 1 Dec 2017 15:31 |
Reporter: | Roy Lyseng | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[4 Jul 2017 10:31]
Roy Lyseng
[4 Sep 2017 11:21]
Abhishek Ranjan
Posted by developer: Bug#83957 implements a workaround of this bug in the code to create information schema views. When this bug is pushed, the work around should be removed. One of test case based on trunk is follows which returns empty result set in 2nd query: SET information_schema_stats=latest; CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_TIME IS NOT NULL AND TABLE_NAME='t1'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_TIME IS NOT NULL AND UPDATE_TIME IS NOT NULL AND TABLE_NAME='t1'; DROP TABLE t1;
[1 Dec 2017 15:31]
Jon Stephens
Documented fix in the MySQL 8.0.4 changelog, as follows: When a stored function is used with a table column value as an argument in a WHERE predicate, its internal not_null_tables property is falsely set to a non-empty value. If this predicate is applied to an outer join operation and one of the arguments is from an inner table of the outer join, the predicate may be used to convert the outer join to an inner join. According to the SQL standard, only functions that have the RETURNS NULL ON NULL INPUT property should behave in that manner. Since MySQL does not currently implement this property, stored functions are changed such that they no longer implement the RETURNS NULL ON NULL INPUT behavior. Closed.