sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

omit_unused_structs ignore enums when it is referenced in an array

Open pengux opened this issue 6 months ago • 0 comments

Version

1.29.0

What happened?

When omit_unused_structs is set, it doesn't generate the Go type for a Postgresql ENUM if the enum is referenced in a table as an array

Relevant log output


Database schema

CREATE TYPE enum_type AS ENUM('a','b');

CREATE TABLE foobar (
  types enum_type[] not null
);

SQL queries

-- name: List :many
SELECT * FROM foobar;

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "postgresql",
    "gen": {
      "go": {
        "out": "db",
        "omit_unused_structs": true
      }
    }
  }]
}

Playground URL

https://play.sqlc.dev/p/0c1fceceeca7b3984de0cf7b28872931ca121211a8ba25c21e11e802b44dea59

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

pengux avatar Jun 02 '25 19:06 pengux