Skip to content

Classify ODBC timestamp interval arguments as time units - #2596

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/odbc-timestamp-units
Sep 11, 2026
Merged

Classify ODBC timestamp interval arguments as time units#2596
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/odbc-timestamp-units

Conversation

@minleejae

@minleejae minleejae commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

In {fn TIMESTAMPADD(SQL_TSI_YEAR, 2, travel_date)}, the interval keyword is currently visited as a column. Classify the nine standard SQL_TSI_* keywords as DateUnitExpression values in the first argument of unqualified ODBC-escaped TIMESTAMPADD/TIMESTAMPDIFF calls 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 check and Maven clean 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 check together (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

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.
@manticore-projects
manticore-projects merged commit a7a5fa5 into JSQLParser:master Sep 11, 2026
9 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support for (date({fn timestampadd(SQL_TSI_YEAR, 2, date("travel_date"))}))

2 participants