Skip to content

sqlc doesn't handle oid types correctly with pgx/v4 #2667

Closed
@andrewmbenton

Description

@andrewmbenton

Version

1.20.0

What happened?

From this discord thread: https://discord.com/channels/946447283321438248/1145749639916683305

It looks like sqlc-generated Go code tries to use a non-existent pgtype.Uint32 for cid and oid database types when configured for pgx/v4 which imports from github.com/jackc/pgtype (see https://github.com/sqlc-dev/sqlc/blob/v1.20.0/internal/codegen/golang/postgresql_type.go#L481).

Note that with pgx/v5 configured, sqlc imports from github.com/jackc/pgx/v5/pgtype which does appear to have the pgtype.Uint32 type.

See the playground link for an example.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/e8c728dddddc0248aae7194bc4d0fac902cc43ae72c2d726a2d7f10c683f82e2

What operating system are you using?

No response

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions