summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-11-20 21:35:54 -0800
committerIgor Babaev <igor@askmonty.org>2021-11-20 21:35:54 -0800
commit114e18b8b68a00b3829ac231cc8f84187f529287 (patch)
tree6b0ef69ef2907eec8d30f3fa2c5581bee7f14593 /sql
parent0dae41637abd24c8f08e925ef00490e949ce581d (diff)
downloadmariadb-git-114e18b8b68a00b3829ac231cc8f84187f529287.tar.gz
MDEV-26470 "No database" selected when using CTE in a subquery of DELETE statement
This bug led to reporting bogus messages "No database selected" for DELETE statements if they used subqueries in their WHERE conditions and these subqueries contained references to CTEs. The bug happened because the grammar rule for DELETE statement did not call the function LEX::check_cte_dependencies_and_resolve_references() and as a result of it references to CTEs were not identified as such. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_yacc.yy4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4dd292258d3..a4b105862f3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -12668,6 +12668,10 @@ delete:
lex->select_lex.init_order();
}
opt_delete_options single_multi
+ {
+ if (Lex->check_cte_dependencies_and_resolve_references())
+ MYSQL_YYABORT;
+ }
;
single_multi: