Structure FOR PORTION intervals in UPDATE and DELETE - #2622
Merged
manticore-projects merged 1 commit intoSep 13, 2026
Conversation
Contributor
|
Thank you! |
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.
Temporal SQL consumers need to retain the interval affected by an UPDATE or DELETE. Stratum currently extracts and removes
FOR PORTION OFbefore parsing, then carries that information separately (pinned consumer workaround). A structured clause keeps the period and bound expressions attached to the statement, making them available to inspection, rewriting, and validation.Support application-time
FOR PORTION OF period FROM expression TO expressionon UPDATE and DELETE targets, as documented for MariaDB application-time periods. For example,UPDATE prices FOR PORTION OF valid_time FROM ? TO ? SET price = ?now preserves the period name, both expressions, and their parameter ordering.Both statements reuse
ForPortionClause, one grammar production, shared deparser handling, and shared validation. Its renderer is also used by model output, while its expression traversal carries visitor context to both bounds. Table discovery visits nested bound expressions, and a dedicated validation feature is included in the MariaDB feature set. This change concerns the DML interval clause; it does not add temporal SELECT syntax or enforce database-specific restrictions on the values of the bounds.Validation: full Java 17 Gradle
checkpasses, including the zero-conflict JavaCC grammar gate, tests, formatting, Checkstyle, PMD, and SpotBugs. Tests cover both statements, aliases and quoted period names, typed literals and parameters, AST mutation, custom deparsers, nested-expression traversal, feature validation, WHERE/ORDER BY/LIMIT/RETURNING boundaries, round trips, and malformed clauses.