diff --git a/internal/compiler/compat.go b/internal/compiler/compat.go index 55a70417b3..097d889cfb 100644 --- a/internal/compiler/compat.go +++ b/internal/compiler/compat.go @@ -14,11 +14,6 @@ func stringSlice(list *ast.List) []string { for _, item := range list.Items { if n, ok := item.(*ast.String); ok { items = append(items, n.Str) - continue - } - if n, ok := item.(*ast.String); ok { - items = append(items, n.Str) - continue } } return items diff --git a/internal/compiler/to_column.go b/internal/compiler/to_column.go index 726b7ff32c..3267107c8b 100644 --- a/internal/compiler/to_column.go +++ b/internal/compiler/to_column.go @@ -7,13 +7,6 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/astutils" ) -func isArray(n *ast.TypeName) bool { - if n == nil || n.ArrayBounds == nil { - return false - } - return len(n.ArrayBounds.Items) > 0 -} - func arrayDims(n *ast.TypeName) int { if n == nil || n.ArrayBounds == nil { return 0 @@ -29,11 +22,12 @@ func toColumn(n *ast.TypeName) *Column { if err != nil { panic("toColumn: " + err.Error()) } + arrayDims := arrayDims(n) return &Column{ Type: typ, DataType: strings.TrimPrefix(astutils.Join(n.Names, "."), "."), NotNull: true, // XXX: How do we know if this should be null? - IsArray: isArray(n), - ArrayDims: arrayDims(n), + IsArray: arrayDims > 0, + ArrayDims: arrayDims, } }