Skip to content

Go code generation fails for PostgreSQL ENUM values with '+' and '-' due to duplicate constant names #4515

Description

@arjun-liveeye

Version

1.31.1

Version

  • sqlc: v1.31.1
  • PostgreSQL: 18x
  • Go: go1.26.1 windows/amd64

What happened?

When using a PostgreSQL ENUM that contains values with + and - (e.g. blood groups), sqlc generates duplicate Go constant names, causing the generated code to fail to compile.

For example:

CREATE TYPE blood_group_type AS ENUM (
    'A+',
    'A-',
    'B+',
    'B-',
    'AB+',
    'AB-',
    'O+',
    'O-'
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions