Classify ODBC timestamp interval arguments as time units - #2596
Merged
manticore-projects merged 1 commit intoSep 11, 2026
Merged
Conversation
Use the existing time-unit AST for standard SQL_TSI_* keywords in escaped TIMESTAMPADD and TIMESTAMPDIFF calls, while preserving ordinary function and identifier handling. Fixes JSQLParser#1139.
Contributor
|
Thanks! |
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.
In
{fn TIMESTAMPADD(SQL_TSI_YEAR, 2, travel_date)}, the interval keyword is currently visited as a column. Classify the nine standardSQL_TSI_*keywords asDateUnitExpressionvalues in the first argument of unqualified ODBC-escapedTIMESTAMPADD/TIMESTAMPDIFFcalls with three arguments.Both functions share the same normalization and existing time-unit visitor/deparser support. Output retains the ODBC keyword. Ordinary calls, qualified function or argument names, quoted identifiers, unknown units, and other argument positions retain their existing interpretation; this does not infer DB-specific semantics for arbitrary function names.
Validation: full Gradle
checkand Mavenclean verify; regression coverage includes all nine units in both functions and parsing modes, round trips, column traversal, AST nodes, nested escapes, case handling, and the scope boundaries above.Integration validation: all twelve existing PRs plus these three independent fixes pass full Gradle
checktogether (6,495 tests; 0 failures/errors; 25 skipped). Existing dialect-enum, shared-index-helper and documentation conflicts were resolved only in the local validation branch.Fixes #1139.
ODBC reference: https://learn.microsoft.com/en-us/sql/odbc/reference/appendixes/time-date-and-interval-functions