From 3a618a53b3f3112f67e024f8edcc8bcaaf8cd9b6 Mon Sep 17 00:00:00 2001 From: NagIzaazShaik <176337212+shaikn6@users.noreply.github.com> Date: Fri, 11 Sep 2026 13:26:28 -0400 Subject: [PATCH] docs: clarify db_type override must use the canonical parser type name db_type overrides are matched against the canonical type name the Postgres parser assigns to a column (e.g. pg_catalog.int4), not the type name written in the schema (e.g. integer). A mismatch fails silently: no error, no override applied. Confirmed by building sqlc and generating with db_type: "integer" (no-op) vs db_type: "pg_catalog.int4" (applied) against an INTEGER column. Fixes #2762 --- docs/howto/overrides.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/howto/overrides.md b/docs/howto/overrides.md index b525994bbf..d0ae1bfd08 100644 --- a/docs/howto/overrides.md +++ b/docs/howto/overrides.md @@ -49,6 +49,15 @@ Each element in the `overrides` list has the following keys: - `db_type`: - A database type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use pg_catalog-prefixed names where available. `db_type` and `column` are mutually exclusive. + + > [!WARNING] + > `db_type` is matched against the canonical type name the Postgres parser + > assigns to the column, not the type name from your schema. For example, + > a column declared `INTEGER` has the canonical type `pg_catalog.int4`, so + > `db_type: "integer"` will silently fail to match (no error, no + > override) and you must write `db_type: "pg_catalog.int4"` instead. When + > unsure of a column's canonical type, check the aliases handled in + > [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go). - `column`: - A column name to override. The value should be of the form `table.column` but you can also specify `schema.table.column` or `catalog.schema.table.column`. `column` and `db_type` are mutually exclusive. - `go_type`: