Commit 08ba4741 authored by Igor Babaev's avatar Igor Babaev

Fixed bug mdev-10783.

Do not push conditions into materialized views/derived tables
marked with the flag 'fill_me'.
parent 54b81ac5
...@@ -7007,3 +7007,12 @@ WHERE f = 1; ...@@ -7007,3 +7007,12 @@ WHERE f = 1;
f f
1 1
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-10783: pushdown into constant view
#
CREATE TABLE t1 (i int) ENGINE=MyISAM;
CREATE VIEW v AS SELECT 5;
SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v );
i
DROP VIEW v;
DROP TABLE t1;
...@@ -898,5 +898,13 @@ SELECT * ...@@ -898,5 +898,13 @@ SELECT *
WHERE f = 1; WHERE f = 1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-10783: pushdown into constant view
--echo #
CREATE TABLE t1 (i int) ENGINE=MyISAM;
CREATE VIEW v AS SELECT 5;
SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v );
DROP VIEW v;
DROP TABLE t1;
\ No newline at end of file
...@@ -1144,6 +1144,10 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived) ...@@ -1144,6 +1144,10 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
if (!any_select_allows_cond_pushdown) if (!any_select_allows_cond_pushdown)
return false; return false;
/* Do not push conditions into constant derived */
if (derived->fill_me)
return false;
/* Do not push conditions into recursive with tables */ /* Do not push conditions into recursive with tables */
if (derived->is_recursive_with_table()) if (derived->is_recursive_with_table())
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment