summaryrefslogtreecommitdiff
path: root/sql/sql_cte.h
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-01-27 21:50:16 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-03-10 07:20:49 +0100
commit50c0939166afa2042a92d59698911fb54529ab39 (patch)
treed37862b225823136bb06c4e049e798b56994e378 /sql/sql_cte.h
parenta5584b13d1e04f38b843602413669591aa65c359 (diff)
downloadmariadb-git-50c0939166afa2042a92d59698911fb54529ab39.tar.gz
MDEV-20632: Recursive CTE cycle detection using CYCLE clause (nonstandard)
Added CYCLE ... RESTRICT (nonstandard) clause to recursive CTE.
Diffstat (limited to 'sql/sql_cte.h')
-rw-r--r--sql/sql_cte.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_cte.h b/sql/sql_cte.h
index 92aca5090f3..4c42dd23614 100644
--- a/sql/sql_cte.h
+++ b/sql/sql_cte.h
@@ -112,6 +112,7 @@ public:
always empty.
*/
List <Lex_ident_sys> column_list;
+ List <Lex_ident_sys> *cycle_list;
/* The query that specifies the table introduced by this with element */
st_select_lex_unit *spec;
/*
@@ -169,7 +170,7 @@ public:
sq_dep_map(0), work_dep_map(0), mutually_recursive(0),
top_level_dep_map(0), sq_rec_ref(NULL),
next_mutually_recursive(NULL), references(0),
- query_name(name), column_list(list), spec(unit),
+ query_name(name), column_list(list), cycle_list(0), spec(unit),
is_recursive(false), rec_outer_references(0), with_anchor(false),
level(0), rec_result(NULL)
{ unit->with_element= this; }
@@ -206,7 +207,7 @@ public:
void inc_references() { references++; }
- bool rename_columns_of_derived_unit(THD *thd, st_select_lex_unit *unit);
+ bool process_columns_of_derived_unit(THD *thd, st_select_lex_unit *unit);
bool prepare_unreferenced(THD *thd);
@@ -214,7 +215,7 @@ public:
table_map &unrestricted,
table_map &encountered);
- void print(String *str, enum_query_type query_type);
+ void print(THD *thd, String *str, enum_query_type query_type);
With_clause *get_owner() { return owner; }
@@ -259,6 +260,8 @@ public:
void prepare_for_next_iteration();
+ void set_cycle_list(List<Lex_ident_sys> *cycle_list_arg);
+
friend class With_clause;
};
@@ -353,7 +356,7 @@ public:
void add_unrestricted(table_map map) { unrestricted|= map; }
- void print(String *str, enum_query_type query_type);
+ void print(THD *thd, String *str, enum_query_type query_type);
friend class With_element;