Skip to content

varchar[] is generated as string instead of []string #2638

Closed
@InbarPerry

Description

@InbarPerry

Version

1.20.0

What happened?

SQLC is generating base type (not array) for columns that was added in a separate migration.
This is a new bug introduced in 1.20 (worked in 1.19)

Relevant log output

// Output in sqlc 1.19:

type Author struct {
	ID    uuid.NullUUID
	Books []string
}

// Output in sqlc 1.20:

type Author struct {
	ID    uuid.NullUUID
	Books string
}

Database schema

CREATE TABLE authors (
  id UUID
);

ALTER TABLE authors ADD COLUMN IF NOT EXISTS books VARCHAR(255)[] DEFAULT NULL;

SQL queries

No response

Configuration

No response

Playground URL

(1.20) https://play.sqlc.dev/p/53e5f0dcb79fb2071328bfdb8507b08b340bfc6024735b53b27a89260d147647
(1.19) https://play.sqlc.dev/p/5f0472ede5543014774f5115321cb73d09e336c8230b90d464892c185a75972e

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions