Skip to content

Conversation

@angelamayxie
Copy link
Contributor

No description provided.

elianddb and others added 30 commits June 13, 2025 09:27
…ouble-quotes

Key write now uses same recursive call to writeMarshalledValue() as value under json_encode.go
Fixes: dolthub/dolt#7998
…atements-info-schema

Fix 9347 panic case statements info schema
Distinguish nils in firstBuffer
Generalize types in `CASE`, `IF`, and `IFNULL`
Adding skipped tests for `UPDATE ... JOIN` bugs
elianddb and others added 29 commits July 10, 2025 09:29
Modified columndefault.go to detect enum data truncation errors and return
ErrInvalidColumnDefaultValue instead of ErrIncompatibleDefaultType to match
MySQL behavior exactly.

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

Co-Authored-By: Claude <[email protected]>
- Add early validation in tableSpecToSchema to catch enum default 0 before conversion
- Prevents columndefault.go from returning "(unknown)" in error messages
- Enhanced validateDefaultExprs to handle enum defaults with proper column context
- Now matches MySQL behavior exactly: "Invalid default value for 'column_name'"

Resolves the remaining column name issue for CREATE TABLE statements
while maintaining all existing INSERT validation functionality.

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

Co-Authored-By: Claude <[email protected]>
Use ctx.GetSessionVariable() instead of ctx.Session.GetSessionVariable()
to properly access session variables in the enum conversion context.
Allow uint16 enum indices to be converted without strict mode validation.
This fixes INSERT IGNORE behavior where stored uint16(0) values should
display as empty strings, matching MySQL behavior exactly.

Resolves the (unknown) error during SELECT after INSERT IGNORE.
Previously used fragile string matching to detect enum data truncation errors:
- if types.IsEnum(col.Type) && strings.Contains(cErr.Error(), "Data truncated for column")

Now enum Convert method returns ErrConvertingToEnum directly for invalid 0 values in strict mode,
which gets properly enhanced with column name and row number via existing error handling pattern:
- else if types.ErrConvertingToEnum.Is(cErr)

This eliminates the fragile string-parsing approach while maintaining exact same functionality
and MySQL-compatible error messages with proper column names and row numbers.

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

Co-Authored-By: Claude <[email protected]>
- Remove unused isInsertContext function from enum.go
- Fix import cycle by removing unnecessary types import from columndefault.go
- Restore necessary DDL validation for proper column name error reporting
- Maintain all functionality while eliminating fragile string matching patterns

All tests pass and MySQL comparison server behavior matches exactly.

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

Co-Authored-By: Claude <[email protected]>
- Add comprehensive test case "enums with zero strict all tables"
- Tests single row insert, multi-row insert, and CREATE TABLE default scenarios
- Ensures both STRICT_TRANS_TABLES and STRICT_ALL_TABLES modes are covered
- Complements existing STRICT_TRANS_TABLES test for complete coverage

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

Co-Authored-By: Claude <[email protected]>
- Use SqlMode struct instead of manual string parsing in isStrictMode
- Leverage LoadSqlMode() and ModeEnabled() methods for proper SQL mode detection
- Unskip enum default validation tests that now work with our implementation
- Update expected error types to ErrInvalidColumnDefaultValue for enum defaults

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

Co-Authored-By: Claude <[email protected]>
- Add validateEnumLiteralDefault method for stricter enum default validation
- Reject numeric index references ('1', 1) for literal enum defaults
- Allow only exact enum value matches for literal defaults
- Preserve original ErrInvalidType format in enum expression
- Fixes enums_with_default_values test failures

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

Co-Authored-By: Claude <[email protected]>
- Move validateEnumLiteralDefault to resolve_column_defaults.go
- Pass actual column name instead of '(unknown)' to match MySQL
- MySQL returns 'Invalid default value for 'column_name'' format
- Remove enum validation from CheckType to avoid duplicate logic
- Verified behavior matches MySQL exactly for both invalid cases

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

Co-Authored-By: Claude <[email protected]>
Split function-specific engine test queries into their own file
- Add missing case for NULL values in validateEnumLiteralDefault function
- MySQL allows DEFAULT NULL for enum columns, but analyzer was rejecting it
- This fixes CREATE TABLE statements with enum columns that have DEFAULT NULL
- Resolves "incompatible type for default value" error for valid enum defaults

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

Co-Authored-By: Claude <[email protected]>
- Added 'enum import error message validation' test to verify proper error format
- Added 'enum default null validation' test to verify DEFAULT NULL works for enums
- These tests correspond to the failing bats tests in auto-bump PR #9491
- Both tests pass and validate the enum fixes are working correctly

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

Co-Authored-By: Claude <[email protected]>
Need to fix error type to match MySQL exactly - should return
ErrInvalidColumnDefaultValue instead of ErrIncompatibleDefaultType.

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

Co-Authored-By: Claude <[email protected]>
@angelamayxie angelamayxie merged commit 788d756 into angela/system_variables Jul 11, 2025
5 checks passed
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.

8 participants