Skip to content

Commit 2b83fbd

Browse files
committed
Map xid8 to pgtype.Uint64 for pgx/v5
Previously xid8 columns generated interface{} because only xid was mapped. Fixes #4290.
1 parent 07c3808 commit 2b83fbd

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

internal/codegen/golang/postgresql_type.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@ func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugi
503503
return "pgtype.XID"
504504
}
505505

506+
case "xid8":
507+
if driver == opts.SQLDriverPGXV5 {
508+
return "pgtype.Uint64"
509+
}
510+
506511
case "box":
507512
if driver.IsPGX() {
508513
return "pgtype.Box"

internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ CREATE TABLE test_table
44
v_oid_null oid,
55
v_tid_null tid,
66
v_xid_null xid,
7+
v_xid8_null xid8,
78
v_cid cid not null,
89
v_oid oid not null,
910
v_tid tid not null,
10-
v_xid xid not null
11+
v_xid xid not null,
12+
v_xid8 xid8 not null
1113
);
1214

0 commit comments

Comments
 (0)