#4515·sqlc

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

Author: arjun-liveeyeCreated Jul 14, 2026Updated Jul 31, 2026
Labelsbug

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:

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