summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-04-07 19:26:58 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-04-07 19:26:58 +0300
commit5fdcd669fa78962ccafc9f7ea843878118ad3d0d (patch)
treec1eb47fba745cd2c29d7b8c6b1caac38f72f81da /sql/sql_lex.cc
parentc2a63ac526bf4cd269def30a3d55ff29fdba8f86 (diff)
downloadmariadb-git-bb-10.6-mdev25362.tar.gz
MDEV-25362: Incorrect name resolution for subqueries in ON expressionsbb-10.6-mdev25362
When adding a subquery, the outer Name_resolution_context should be the top context on the context stack, not the WHERE-clause level Name_resolution_context of the parent select. This makes a difference when the subquery is in the ON expression: it should follow the name resolution rules of the ON expression, not of the WHERE.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 02652dd095c..f8654c454c5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -10080,7 +10080,7 @@ SELECT_LEX *LEX::parsed_subselect(SELECT_LEX_UNIT *unit)
(curr_sel == NULL && current_select == &builtin_select));
if (curr_sel)
{
- curr_sel->register_unit(unit, &curr_sel->context);
+ curr_sel->register_unit(unit, context_stack.head());
curr_sel->add_statistics(unit);
}