summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-08 11:45:28 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-08 11:45:28 +0300
commit57022dfb25b931a329905364d7056ac61950d300 (patch)
tree94a7131bfffa205d89a8563a5c749f843b920ecb /sql
parenteb14e073ea121954fb5be6fac92fd84b7d57bb07 (diff)
parentbefb0bed68b555852e01859a846bf7ac40f15dbb (diff)
downloadmariadb-git-57022dfb25b931a329905364d7056ac61950d300.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cte.cc1
-rw-r--r--sql/sql_derived.cc7
-rw-r--r--sql/sql_sequence.cc13
-rw-r--r--sql/sql_union.cc13
-rw-r--r--sql/sql_yacc_ora.yy4
5 files changed, 30 insertions, 8 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index e452196a271..d4b6d815118 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1123,6 +1123,7 @@ bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
{
derived= with_elem->spec;
if (derived != select_lex->master_unit() &&
+ !with_elem->is_recursive &&
!is_with_table_recursive_reference())
{
derived->move_as_slave(select_lex);
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 8396fd89433..3b312225937 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2015, MariaDB
+ Copyright (c) 2010, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1197,7 +1197,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_ASSERT(derived->table && derived->table->is_created());
select_unit *derived_result= derived->derived_result;
SELECT_LEX *save_current_select= lex->current_select;
- bool derived_recursive_is_filled= false;
if (derived->pushdown_derived)
{
@@ -1238,7 +1237,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
{
/* In this case all iteration are performed */
res= derived->fill_recursive(thd);
- derived_recursive_is_filled= true;
}
}
else if (unit->is_unit_op())
@@ -1294,8 +1292,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
}
}
err:
- if (res || (!lex->describe && !unit->uncacheable &&
- (!derived_is_recursive || derived_recursive_is_filled)))
+ if (res || (!derived_is_recursive && !lex->describe && !unit->uncacheable))
unit->cleanup();
lex->current_select= save_current_select;
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index 0b73f3ef629..91959f85e64 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -203,6 +203,16 @@ bool check_sequence_fields(LEX *lex, List<Create_field> *fields)
reason= "Sequence tables cannot have any keys";
goto err;
}
+ if (lex->alter_info.check_constraint_list.elements > 0)
+ {
+ reason= "Sequence tables cannot have any constraints";
+ goto err;
+ }
+ if (lex->alter_info.flags & ALTER_ORDER)
+ {
+ reason= "ORDER BY";
+ goto err;
+ }
for (field_no= 0; (field= it++); field_no++)
{
@@ -210,7 +220,8 @@ bool check_sequence_fields(LEX *lex, List<Create_field> *fields)
if (my_strcasecmp(system_charset_info, field_def->field_name,
field->field_name.str) ||
field->flags != field_def->flags ||
- field->type_handler() != field_def->type_handler)
+ field->type_handler() != field_def->type_handler ||
+ field->check_constraint || field->vcol_info)
{
reason= field->field_name.str;
goto err;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 5ff88e02f5d..26f08a165b3 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -2071,6 +2071,19 @@ bool st_select_lex::cleanup()
delete join;
join= 0;
}
+ for (TABLE_LIST *tbl= get_table_list(); tbl; tbl= tbl->next_local)
+ {
+ if (tbl->is_recursive_with_table() &&
+ !tbl->is_with_table_recursive_reference())
+ {
+ /*
+ If query is killed before open_and_process_table() for tbl
+ is called then 'with' is already set, but 'derived' is not.
+ */
+ st_select_lex_unit *unit= tbl->with->spec;
+ error|= (bool) error | (uint) unit->cleanup();
+ }
+ }
for (SELECT_LEX_UNIT *lex_unit= first_inner_unit(); lex_unit ;
lex_unit= lex_unit->next_unit())
{
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 6d6dc188457..c42c8e68e96 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -4569,7 +4569,7 @@ sp_labeled_block:
{
Lex->sp_block_init(thd, &$1);
}
- sp_decl_body_list
+ opt_sp_decl_body_list
{
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
@@ -4611,7 +4611,7 @@ sp_unlabeled_block:
MYSQL_YYABORT;
Lex->sp_block_init(thd);
}
- sp_decl_body_list
+ opt_sp_decl_body_list
{
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;