MDEV-40573: Crash on multi-table DELETE with an impossible WHERE - #5478
Open
DaveGosselin-MariaDB wants to merge 1 commit into
Open
MDEV-40573: Crash on multi-table DELETE with an impossible WHERE#5478DaveGosselin-MariaDB wants to merge 1 commit into
DaveGosselin-MariaDB wants to merge 1 commit into
Conversation
A DELETE containing a single table, an index hint, an impossible WHERE condition, and a window function will take the multi-delete code path but never initialize tables for deletion, leading to a crash. Such a statement would never delete rows from the target table. Record in the multi_delete whether it was ever initialized for execution, and don't attempt to delete anything if it wasn't initialized. The index hint forces the single table DELETE to take the multi-table codepath. Since this case has an impossible WHERE condition, we set subq_exit_fl which later causes JOIN::optimize_stage2 to skip the multi-delete table initialization. It's not safe to attempt initialization when trying to find a "tableless" subquery plan, so defend against this case with the new multi-delete flag added by this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A DELETE containing a single table, an index hint, an impossible WHERE condition, and a window function will take the multi-delete code path but never initialize tables for deletion, leading to a crash. Such a statement would never delete rows from the target table. Record in the multi_delete whether it was ever initialized for execution, and don't attempt to delete anything if it wasn't initialized.
The index hint forces the single table DELETE to take the multi-table codepath. Since this case has an impossible WHERE condition, we set subq_exit_fl which later causes JOIN::optimize_stage2 to skip the multi-delete table initialization. It's not safe to attempt initialization when trying to find a "tableless" subquery plan, so defend against this case with the new multi-delete flag added by this commit.