diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index c5006277d..5c79def66 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -4810,7 +4810,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i } // Until we handle recursive cte: - if (gwi.thd->lex->derived_tables == DERIVED_WITH) + With_clause* with_clause = select_lex.get_with_clause(); + if (with_clause && with_clause->with_recursive) { gwi.fatalParseError = true; gwi.parseErrorText = "Recursive CTE"; diff --git a/dbcon/mysql/idb_mysql.h b/dbcon/mysql/idb_mysql.h index 637f517d7..d8e634118 100644 --- a/dbcon/mysql/idb_mysql.h +++ b/dbcon/mysql/idb_mysql.h @@ -67,6 +67,7 @@ template bool isnan(T); #include "sql_select.h" #include "mysqld_error.h" #include "item_windowfunc.h" +#include "sql_cte.h" // Now clean up the pollution as best we can... #undef min