diff options
author | Igor Babaev <igor@askmonty.org> | 2021-04-19 19:52:06 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-04-22 13:56:50 -0700 |
commit | b3b5d57e78f835473d13d383caacb7320b5938d5 (patch) | |
tree | 944f0e6eb27dbbd781d8f27618e4dce10986256c /sql/sql_lex.h | |
parent | 5c5d24c772d4596b0c28f2267477afe448d6e7f7 (diff) | |
download | mariadb-git-b3b5d57e78f835473d13d383caacb7320b5938d5.tar.gz |
MDEV-24823 Crash with invalid multi-table update of view in 2nd execution of SP
Before this patch mergeable derived tables / view used in a multi-table
update / delete were merged before the preparation stage.
When the merge of a derived table / view is performed the on expression
attached to it is fixed and ANDed with the where condition of the select S
containing this derived table / view. It happens after the specification of
the derived table / view has been merged into S. If the ON expression refers
to a non existing field an error is reported and some other mergeable derived
tables / views remain unmerged. It's not a problem if the multi-table
update / delete statement is standalone. Yet if it is used in a stored
procedure the select with incompletely merged derived tables / views may
cause a problem for the second call of the procedure. This does not happen
for select queries using derived tables / views, because in this case their
specifications are merged after the preparation stage at which all ON
expressions are fixed.
This patch makes sure that merging of the derived tables / views used in a
multi-table update / delete statement is performed after the preparation
stage.
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r-- | sql/sql_lex.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 31751a16471..49265accc07 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1147,6 +1147,8 @@ public: bool save_leaf_tables(THD *thd); bool save_prep_leaf_tables(THD *thd); + void set_unique_exclude(); + bool is_merged_child_of(st_select_lex *ancestor); /* |