Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Add coverage for the analogous FOR PORTION OF path and address the two style nits.
Review effort: Lite
Findings: None
What changed in this PR
Fixes MDEV-40821 by attaching versioning conditions to the intended DELETE target, preventing a SIGSEGV when expressions introduce another table.
Changes:
- Uses
correspondent_tablefor condition assignment. - Adds regression coverage for sequence and window-function expressions.
- Updates expected results.
| File | Summary |
|---|---|
sql/sql_yacc.yy |
Corrects DELETE condition association. A moderate regression case remains missing for FOR PORTION OF with setval(), along with two line-length nits. |
mysql-test/suite/versioning/t/delete_history.test |
Adds MDEV-40821 regression cases. |
mysql-test/suite/versioning/r/delete_history.result |
Records expected test results. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Window_funcs_sort failed accessing win_func->window_spec as window spec was not defined in the query. Usually this is checked by fixing item win_func, but it was not done by setup_conds. Actually, earlier check by vers_setup_conds() must fail on DELETE HISTORY from non-versioned table, but TABLE_LIST for t1 has no versioning conditions. The cause was the parser assigning versioning conditions to wrong table pointed by last_table() which was already switched to another table from SYSTEM_TIME expression (cs1). The fix assigns versioning conditions to the correct table stored to correspondent_table by delete_single_table branch of the parser.
midenok
force-pushed
the
11.8-midenok-MDEV-40821
branch
from
September 21, 2026 17:41
6c91d89 to
f0f8aef
Compare
|
|
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.

Window_funcs_sort failed accessing win_func->window_spec as window spec was not defined in the query. Usually this is checked by fixing item win_func, but it was not done by setup_conds.
Actually, earlier check by vers_setup_conds() must fail on DELETE HISTORY from non-versioned table, but TABLE_LIST for t1 has no versioning conditions.
The cause was the parser assigning versioning conditions to wrong table pointed by last_table() which was already switched to another table from SYSTEM_TIME expression (cs1).
The fix assigns versioning conditions to the correct table stored to correspondent_table by delete_single_table branch of the parser.