feat: expose dialect-aware current-time expression metadata - #2649
Merged
manticore-projects merged 2 commits intoSep 20, 2026
Merged
manticore-projects merged 2 commits into
manticore-projects merged 2 commits into
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.
Consumers inspecting current-time expressions must currently handle TimeKeyExpression, Function and Column separately. For example, PostgreSQL
CURRENT_TIMESTAMP,CURRENT_TIMESTAMP(6)and bareLOCALTIMEuse three different node classes, and MySQL's LOCALTIME alias has different semantics from PostgreSQL's.Add
TemporalExpressionInfo.from(expression, dialect)as a common read-only metadata API for MySQL and PostgreSQL. It reports the normalized kind, original name, explicit precision and parentheses while retaining existing AST classes and rendering. It handles MySQL NOW/CURDATE/CURTIME aliases, PostgreSQL now(), grouping, and the dialect-specific LOCALTIME/LOCALTIMESTAMP meanings. Quoted/qualified identifiers, unrelated expressions and unsupported call shapes return an empty result.Results are snapshots and precision is the requested value. This API does not apply database range validation or clamping: PostgreSQL accepts precision 7 with a warning and clamps it to 6, while MySQL rejects it. Usage and these boundaries are documented.
Validation: Gradle
checkpassed (7549 tests, 0 failures, 0 errors, 25 skipped), including formatting, grammar and static checks. A 160-case execution matrix on PostgreSQL 18.6 and MySQL 8.4.11 supplied 43 accepted fixtures. All accepted originals and both rendered forms executed successfully (129 executions). Tests also cover omitted/zero precision, aliases, quoted/qualified names, invalid argument shapes, AST-class preservation and edits after a metadata snapshot.Syntax references: PostgreSQL current date/time functions, MySQL date/time functions.