Skip to content

xid type is interface when using pgx #4290

@jay-babu

Description

@jay-babu

Version

1.30.0

What happened?

I have set. I have a column that is set to xid8 in my postgres table. My understanding is that based on this PR: https://github.com/sqlc-dev/sqlc/pull/2668/changes. XID should be of type Uint32 however I am generating the code and am getting interface{} as the output.

        sql_package: "pgx/v5"
        sql_driver: "github.com/jackc/pgx/v5"

table:

CREATE TABLE IF NOT EXISTS audit_context (
    txid xid8 PRIMARY KEY,
    audit_user TEXT,
    request_id TEXT,
    audit_reason TEXT,
    cohort_id BIGINT,
    created_at TIMESTAMPTZ DEFAULT now()
);

full config

# yaml-language-server: $schema=https://raw.githubusercontent.com/sqlc-dev/sqlc/main/internal/config/v_two.json
version: "2"
sql:
  - engine: "postgresql"
    queries: "queries"
    schema: "pos-db/migrations"
    strict_function_checks: true
    strict_order_by: true
    gen:
      go:
        package: "model"
        out: "."
        sql_package: "pgx/v5"
        sql_driver: "github.com/jackc/pgx/v5"
        emit_empty_slices: true
        query_parameter_limit: 0
        emit_sql_as_comment: true
        emit_interface: true
        overrides:
          # Numeric type overrides
          - go_type: github.com/shopspring/decimal.Decimal
            db_type: pg_catalog.numeric
          - go_type: github.com/shopspring/decimal.NullDecimal
            db_type: pg_catalog.numeric
            nullable: true

          # JSONB column-specific overrides (types from libs/jsontypes)
          - column: "job.metadata"
            go_type:
              import: "github.com/Transformity/zeus/libs/jsontypes"
              type: "JobMetadata"
              pointer: true

          - column: "entity.deployment_configuration"
            go_type:
              import: "github.com/Transformity/zeus/libs/jsontypes"
              type: "DeploymentConfiguration"
              pointer: true
      - column: "job_event.metadata"
        go_type:
          import: "github.com/Transformity/zeus/libs/jsontypes"
          type: "JobMetadata"
          pointer: true

### Relevant log output

```shell

Database schema

SQL queries

Configuration

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

Postgresql

What type of code are you generating?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions