Skip to content

dolthub/dolt#9530 - Fix auto-increment overflow handling to match MySQL behavior #3103

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

elianddb
Copy link
Contributor

@elianddb elianddb commented Jul 16, 2025

Fixes dolthub/dolt#9530
Added bounds checking for auto-increment values to prevent overflow beyond data type limits. The fix ensures auto-increment values don't exceed type maximums (e.g., 127 for TINYINT) and correctly throws duplicate key errors instead of allowing overflow.

Added bounds checking for auto-increment values to prevent overflow beyond data type limits.
The fix ensures auto-increment values don't exceed type maximums (e.g., 127 for TINYINT)
and correctly throws duplicate key errors instead of allowing overflow.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@elianddb elianddb force-pushed the elianddb/9530-fix-auto-increment-overflow branch from 3cc95a1 to 9b6b168 Compare July 16, 2025 21:52
elianddb and others added 5 commits July 16, 2025 22:00
Removed Skip: true from tests that verify auto-increment behavior at maximum values.
Our fix now allows these tests to pass:
- Insert max values (127 for TINYINT, 32767 for SMALLINT, etc.)
- Verify SHOW CREATE TABLE shows correct AUTO_INCREMENT values
- Removed redundant auto_increment_overflow_test.go file

Tests now properly validate that AUTO_INCREMENT values don't exceed type limits
and display correctly in SHOW CREATE TABLE output.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Inlined bounds checking logic directly where used instead of helper function:
- Removed canIncrementAutoIncVal() helper function from table.go
- Inlined logic in table_editor.go Insert method (2 locations)
- Inlined logic in table.go AddColumn method (1 location)
- Used existing colType.Convert() pattern for type checking

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

auto_increment with max integers does not error properly
1 participant