1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-20632: Recursive CTE cycle detection using CYCLE clause (nonstandard)

Added CYCLE ... RESTRICT (nonstandard) clause to recursive CTE.
This commit is contained in:
Oleksandr Byelkin
2020-01-27 21:50:16 +01:00
parent a5584b13d1
commit 50c0939166
20 changed files with 619 additions and 147 deletions

View File

@@ -138,7 +138,7 @@ bool check_duplicate_names(THD *thd, List<Item> &item_list, bool gen_unique_view
Item *check;
/* treat underlying fields like set by user names */
if (item->real_item()->type() == Item::FIELD_ITEM)
item->is_autogenerated_name= FALSE;
item->common_flags&= ~IS_AUTO_GENERATED_NAME;
itc.rewind();
while ((check= itc++) && check != item)
{
@@ -146,9 +146,9 @@ bool check_duplicate_names(THD *thd, List<Item> &item_list, bool gen_unique_view
{
if (!gen_unique_view_name)
goto err;
if (item->is_autogenerated_name)
if (item->is_autogenerated_name())
make_unique_view_field_name(thd, item, item_list, item);
else if (check->is_autogenerated_name)
else if (check->is_autogenerated_name())
make_unique_view_field_name(thd, check, item_list, item);
else
goto err;
@@ -180,7 +180,7 @@ void make_valid_column_names(THD *thd, List<Item> &item_list)
for (uint column_no= 1; (item= it++); column_no++)
{
if (!item->is_autogenerated_name || !check_column_name(item->name.str))
if (!item->is_autogenerated_name() || !check_column_name(item->name.str))
continue;
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
item->orig_name= item->name.str;
@@ -566,7 +566,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
while ((item= it++, name= nm++))
{
item->set_name(thd, *name);
item->is_autogenerated_name= FALSE;
item->common_flags&= ~IS_AUTO_GENERATED_NAME;
}
}