fix: emit bare CURRENT_TIMESTAMP(6) default for TIMESTAMP(6)/DATETIME(6) - #596
Open
The-king-king wants to merge 1 commit into
Open
fix: emit bare CURRENT_TIMESTAMP(6) default for TIMESTAMP(6)/DATETIME(6)#596The-king-king wants to merge 1 commit into
The-king-king wants to merge 1 commit into
Conversation
to_simple_mysql_col_type does an exact match on the raw COLUMN_TYPE and returns Unknown for "timestamp(6)"/"datetime(6)", so the type branch never matched and the value was emitted as DEFAULT 'CURRENT_TIMESTAMP(6)', which MySQL rejects with 1064 (5.7) / 1067 (8.0). Match the base type name by prefix on the raw type string instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
to_simple_mysql_col_typedoes an exact match on the rawinformation_schema.COLUMNS.COLUMN_TYPEstring and returnsUnknownfor types with a precision suffix (e.g.timestamp(6)/datetime(6)), so the current-timestamp type branch inparse_column_defaultnever matched.DEFAULT 'CURRENT_TIMESTAMP(6)', which MySQL rejects with1064(5.7) /1067(8.0)Invalid default value.DEFAULT CURRENT_TIMESTAMP(6).This regression was introduced in #431 (which refactored
parse_column_defaultto pass rawcol_type), an incomplete fix from #403.Test plan
cargo check -p dt-connectorpassestimestamp(6) DEFAULT CURRENT_TIMESTAMP(6) NOT NULLcolumn🤖 Generated with Claude Code