You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using this driver with the go sql package, ColumnType.DatabaseTypeName, ScanType, Length, and DecimalSize panics when a column type is unsupported.
Current behavior means calling ColumnTypes() or related methods in the database/sql lib panics if I'm doing something like select * on a table with an unsupported column (or trying to use the driver for generic queries). Matching the spec would let clients handle the cases.
To Reproduce
func TestMakeGoLangUnsupportedType(t *testing.T) {
makeGoLangTypeName(typeInfo{TypeId: 123})
}
// --- FAIL: TestMakeGoLangTypeName1 (0.00s)
// panic: not implemented makeGoLangTypeName for type 123 [recovered]
// panic: not implemented makeGoLangTypeName for type 123
Expected behavior
Instead of a panic, it should return nil values as appropriate for callers to handle.
kellymtrinh
changed the title
DatabaseTypeName panics with unsupported column types instead of returning empty string
ColumnType methods panic when unsupported
Jun 1, 2022
Describe the bug
When using this driver with the go sql package, ColumnType.DatabaseTypeName, ScanType, Length, and DecimalSize panics when a column type is unsupported.
Could this return the nil values as appropriate when it's not supported, to match what is described here: "If an empty string is returned, then the driver type name is not supported."?
Current behavior means calling ColumnTypes() or related methods in the database/sql lib panics if I'm doing something like
select *
on a table with an unsupported column (or trying to use the driver for generic queries). Matching the spec would let clients handle the cases.To Reproduce
Expected behavior
Instead of a panic, it should return nil values as appropriate for callers to handle.
Further technical details
The panic happens in
makeGoLangTypeName
, which is used inColumnTypeScanType
andColumnTypeScanType
.The other methods can be found in
types.go
too.The text was updated successfully, but these errors were encountered: