-
-
Notifications
You must be signed in to change notification settings - Fork 238
dolthub/dolt#9424 - Fix enum foreign key constraints to match MySQL behavior #3074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Allow enum types to reference each other in foreign keys regardless of string values - MySQL allows enum foreign keys to match based on underlying numeric values - Modified foreignKeyComparableTypes to handle enum types specially - Updated test expectations to use correct error types (ErrForeignKeyChildViolation) - Removed Skip flag from 'enums with foreign keys' test 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Convert ErrConvertingToEnum to ErrDataTruncatedForColumn in INSERT context - This matches MySQL behavior for enum validation errors - Fixed the 'value X is not valid for this Enum' vs 'Data truncated for column' issue Note: Still debugging foreign key constraint validation issue
- Fixed enum validation error messages in INSERT context - Core enum FK creation functionality works correctly - Some test cases still failing due to constraint validation issues - Need to debug why enum FK constraints aren't being enforced properly
- Update test expectations from 'value X is not valid for this Enum' to 'Data truncated for column' - Ensures consistency with MySQL 8.0 error message format - Fixes enum_errors and enums_with_default test failures
- Update test to expect ErrDataTruncatedForColumn instead of ErrConvertingToEnum - Removes TODO comment as the fix is now implemented - Matches MySQL behavior for enum validation error messages
- Added ErrDataTruncatedForColumnAtRow error type in types/enum.go - Added rowNumber field to insertIter struct to track current row - Modified enum error conversion in insert.go to use row-specific error - Updated test expectations in script_queries.go to match new format - MySQL returns: 'Data truncated for column 'e' at row 1' - Now matches MySQL behavior exactly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Updated issue 8611 test to expect ErrDataTruncatedForColumnAtRow instead of ErrDataTruncatedForColumn - Test was failing because it expected the old error type without row information - All INSERT IGNORE tests now pass with the new MySQL-compliant error format 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
elianddb
added a commit
that referenced
this pull request
Jul 8, 2025
- Add ErrDataTruncatedForColumnAtRow error type - Convert ErrConvertingToEnum to proper error with row number - Track row numbers in insert iterator for accurate error reporting - Update test expectations to use new error format - INSERT IGNORE functionality now works correctly for enum conversion Based on successful solution from issue 9424 PR #3074
jycor
approved these changes
Jul 8, 2025
Contributor
jycor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.
Fixes dolthub/dolt#9424
🤖 Generated with Claude Code