Open topofstack opened 1 week ago
When parsing enum type with a single value, function extractEnumNamedValues works incorrectly, returning valid==false for single-value enum with zero value:
valid==false
_, _, _, valid := extractEnumNamedValues("Enum8('FOO' = 0)") fmt.Println(valid) // false
The output is correct if two or more enum values are passed:
_, _, _, valid := extractEnumNamedValues("Enum8('FOO' = 0, 'BAR' = 1") fmt.Println(valid) // true
or value is not zero:
_, _, _, valid := extractEnumNamedValues("Enum8('FOO' = 1") fmt.Println(valid) // true
Looks like we need to add additional check here https://github.com/ClickHouse/clickhouse-go/blob/v2.30.0/lib/column/enum.go#L169
// Enum type must have at least one value if valueIndex == 0 && !indexFound{ return }
clickhouse-go
Observed
When parsing enum type with a single value, function extractEnumNamedValues works incorrectly, returning
valid==false
for single-value enum with zero value:The output is correct if two or more enum values are passed:
or value is not zero:
Details
Looks like we need to add additional check here https://github.com/ClickHouse/clickhouse-go/blob/v2.30.0/lib/column/enum.go#L169
Environment
clickhouse-go
v2.30.0