sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.51k stars 810 forks source link

Type override not working on array #3716

Open dcrystalj opened 21 hours ago

dcrystalj commented 21 hours ago

Version

1.27.0

What happened?

When overriding int8 to uint it is not respected when using syntax like .... _id = ANY($1::int8[]); Generated function creates int64 parameter instead of uint.

Relevant log output

No response

Database schema

No response

SQL queries

SELECT *
FROM page
WHERE internal_id = ANY($1::int8[]);

Configuration

{
  "version": "2",
  "sql": [
    {
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql",
      "gen": {
        "go": {
          "package": "db",
          "out": "db",
          "sql_package": "pgx/v5",
          "overrides": [
            {
              "db_type": "pg_catalog.int8",
              "go_type": {
                "type": "uint"
              }
           }
          ]
        }
      }
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/3c687ce27bb56bf8c536047234a748c6a17e283475e00516c8df113d0f9fd45e

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go