summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5e9d9a8eb17..a01b1547cf1 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -11924,9 +11924,18 @@ bool SELECT_LEX_UNIT::explainable() const
false;
}
+/*
+ Determines whether the derived table was eliminated during
+ the call of eliminate_tables(JOIN *) made at the optimization stage
+ or completely optimized out (for such degenerate statements like
+ "SELECT 1", for example)
+*/
+
bool SELECT_LEX_UNIT::is_derived_eliminated() const
{
if (!derived)
return false;
+ if (!derived->table)
+ return true;
return derived->table->map & outer_select()->join->eliminated_tables;
}