Repository navigation
MySQL: Support compound time units in EXTRACT and INTERVAL - #2700
Open
princejain756 wants to merge 1 commit into
Open
princejain756 wants to merge 1 commit into
princejain756 wants to merge 1 commit into
Conversation
princejain756
force-pushed
the
mysql-compound-datetime-units
branch
from
October 21, 2026 21:55
96f4701 to
56c476d
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.
MySQL and MariaDB accept 11 compound time units in
EXTRACT(unit FROM expr)andINTERVAL expr unitexpressions (SECOND_MICROSECOND,MINUTE_MICROSECOND,MINUTE_SECOND,HOUR_MICROSECOND,HOUR_SECOND,HOUR_MINUTE,DAY_MICROSECOND,DAY_SECOND,DAY_MINUTE,DAY_HOUR,YEAR_MONTH), which previously failed withExpected: date/time fieldorINTERVAL requires a unit after the literal value:This change adds the 11 compound unit keywords and
DateTimeFieldvariants and recognizes them inParser::parse_date_time_fieldandParser::next_token_is_temporal_unit, gated by a newDialect::supports_compound_date_time_fieldsso other dialects keep treating the words as custom fields or rejecting them.Closes #2693
Dialects: MySQL, MariaDB
This PR was implemented with AI assistance.