diff options
author | Igor Babaev <igor@askmonty.org> | 2021-03-21 12:08:54 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-03-21 12:11:20 -0700 |
commit | aba7884138fa649f3e1377174afbb567cf3be7af (patch) | |
tree | 9235cbdf56afb924ab83d1461aaf4f517f195bcf /sql | |
parent | d8dc8537e4f6cfb3b0c63123a8d9df5c1101970d (diff) | |
download | mariadb-git-aba7884138fa649f3e1377174afbb567cf3be7af.tar.gz |
MDEV-25206 Crash with CREATE VIEW .. SELECT with non-existing field
in ON condition
The fix of the bug MDEV-25002 for 10.4 turned out to be incomplete. It
caused crashes when executing CREATE VIEW, CREATE TABLE .. SELECT,
INSERT .. SELECT statements if their SELECTs contained references to
non-existing fields.
This patch complements the fix for MDEV-25002 in order to avoid such
crashes.
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc index b8eb0d453d5..ab1916c766f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5422,8 +5422,9 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) Name_resolution_context *outer_context= 0; SELECT_LEX *select= 0; /* Currently derived tables cannot be correlated */ - if (current_sel->master_unit()->first_select()->get_linkage() != - DERIVED_TABLE_TYPE) + if ((current_sel->master_unit()->first_select()->get_linkage() != + DERIVED_TABLE_TYPE) && + current_sel->master_unit()->outer_select()) outer_context= context->outer_context; /* |