feat: handle unsigned types#80
Merged
Mandukhai-Alimaa merged 2 commits intoadbc-drivers:mainfrom Mar 17, 2026
Merged
Conversation
Mandukhai-Alimaa
requested changes
Mar 16, 2026
go/connection_getobjects.go
Outdated
| // Build the full type name including UNSIGNED if applicable | ||
| xdbcTypeName := tc.DataType | ||
| if strings.Contains(strings.ToUpper(tc.ColumnType), "UNSIGNED") { | ||
| xdbcTypeName = tc.DataType + " unsigned" |
Contributor
There was a problem hiding this comment.
Suggested change
| xdbcTypeName = tc.DataType + " unsigned" | |
| xdbcTypeName = tc.DataType + " UNSIGNED" |
go/connection.go
Outdated
Comment on lines
+85
to
+174
| @@ -95,6 +96,7 @@ func (c *mysqlConnectionImpl) GetTableSchema(ctx context.Context, catalog *strin | |||
| ORDINAL_POSITION, | |||
| COLUMN_NAME, | |||
| DATA_TYPE, | |||
| COLUMN_TYPE, | |||
| IS_NULLABLE, | |||
| CHARACTER_MAXIMUM_LENGTH, | |||
| NUMERIC_PRECISION, | |||
| @@ -132,6 +134,7 @@ func (c *mysqlConnectionImpl) GetTableSchema(ctx context.Context, catalog *strin | |||
| &col.OrdinalPosition, | |||
| &col.ColumnName, | |||
| &col.DataType, | |||
| &col.ColumnType, | |||
| &col.IsNullable, | |||
| &col.CharacterMaximumLength, | |||
| &col.NumericPrecision, | |||
| @@ -166,9 +169,15 @@ func (c *mysqlConnectionImpl) GetTableSchema(ctx context.Context, catalog *strin | |||
| scale = &col.NumericScale.Int64 | |||
| } | |||
|
|
|||
| // Use DATA_TYPE but append UNSIGNED if COLUMN_TYPE indicates it | |||
| dbTypeName := col.DataType | |||
| if strings.Contains(strings.ToUpper(col.ColumnType), "UNSIGNED") { | |||
Contributor
There was a problem hiding this comment.
This check may be too broad in the INFORMATION_SCHEMA paths (in both GetTableSchema and getTablesWithColumns). MySQL's COLUMN_TYPE includes enum/set value lists, so enum('unsigned','signed','pending') will match and incorrectly become "ENUM UNSIGNED". We should probably gate the logic to integer DATA_TYPEs only (TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT) to prevent false positives.
Contributor
Author
|
thanks for the review. that was a good catch. |
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.
adds handling for unsigned types:
UNSIGNED INTinstead ofINT UNSIGNEDand we have to flip it back.