[MDEV-24823] Crash with invalid multi-table update of view in 2nd execution of SP Created: 2021-02-09 Updated: 2022-11-10 Resolved: 2021-04-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Update |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.38, 10.3.29, 10.4.19, 10.5.10, 10.6.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alice Sherepa | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
crash on debug/non-debug builds, with MyIsam/InnoDB
|
| Comments |
| Comment by Igor Babaev [ 2021-03-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here's how the server is brought to the reported crash.
that merges the specification of the view v2 into
with the function mysql_derived_merge().
The call of mysql_handle_derived(lex, DT_PREPARE) does not assign v2->table anything because v2 has been merged. The following call of setup_tables_and_check_access() sees that | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2021-04-03 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A similar test case with multi-table delete demonstrates just a minor promlem:
We see that the first and the second call of sp1 report errors with slightly different error messages. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2021-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following change fixes the reported problem:
After having applied this diff we have:
However in debugger we see that for the first call of sp1 the bug is reported after the call of fix_fields() for the ON expression in the function mysql_derived_merge() while for the second call of sp1 it happens when after fix_fields() for the ON expression is called in setup_on_expr().
we see that for both calls of sp0() it happens when fix_fields() for ON expression is called in setup_on_expr(). We also see that for the following SP
the first and the second calls of sp2 report different error messages
So the suggested fix cannot be considered as satisfactory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-04-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK to push |