Skip to content

Array of enum type is generated as a single enum value #2610

Closed
@roskee

Description

@roskee

Version

1.20.0

What happened?

This is a bug introduced on v1.20.0. It works as expected on v1.19.0

This is the schema I was trying to create

ALTER TABLE some_table ADD COLUMN my_columns custom_enum_type[] NOT NULL;

sqlc generated the model for the above table as follows

type SomeTable struct {
    // ... other columns
    MyColumns CustomEnumType
}

But since my_columns is an array I expected MyColumns field to be []CustomEnumType.
I have created a sample on sqlc playground.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/6310bb377a5dede9cb442c99ced56ef83e97414bb4b8e3dc97edb38191cf8477

What operating system are you using?

Linux

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