Closed
Description
Version
Other
What happened?
v1.19.0 (not an option in the dropdown)
I added omit_unused_structs
to our sqlc.yaml.
The resulting generated code included duplicate definitions for several enums, including type def, constants, methods, causing a compilation failure.
$ grep "^type" models.go | sort | uniq -c | grep -v 1
2 type CookingType string
2 type HomeOwnershipType string
2 type NullCookingType struct {
2 type NullHomeOwnershipType struct {
2 type NullSpaceHeatingType struct {
2 type NullWaterHeatingType struct {
2 type SpaceHeatingType string
2 type WaterHeatingType string
Unfortunately, I can't reproduce using a trivial example in the playground, and I'm out of debugging time, so I'm filing this in the hopes that the problem is obvious from the symptoms.
Relevant log output
// none
Database schema
CREATE TYPE cooking_type AS ENUM(
'gas',
'electric',
'induction',
'other',
'unknown'
);
SQL queries
No response
Configuration
version: 1
packages:
- path: "."
name: "sqlc"
sql_package: "pgx/v5"
engine: "postgresql"
schema: "../migration"
queries: // redacted
emit_exact_table_names: true
emit_enum_valid_method: true
emit_all_enum_values: true
emit_result_struct_pointers: true
emit_params_struct_pointers: true
omit_unused_structs: true
Playground URL
https://play.sqlc.dev/p/ec4ad0299744dc223ce2402ec06836dedc94d4cf2cf7727950c9e0f284132b44
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go