From 2ea7471762c4423fd0abc07b4d75bc9a465978e3 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sat, 14 Feb 2026 02:05:00 +0100 Subject: [PATCH 1/2] Make LoadTypes query easier to support on "postgres-like" servers I'm working with one of the many Postgres "compatible" servers, and making this small change to the query from the `LoadTypes` function makes it "just work". Afaict there was no reason to use the simple protocol for this query. --- derived_types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/derived_types.go b/derived_types.go index eeb8e2a10..bb2532cc3 100644 --- a/derived_types.go +++ b/derived_types.go @@ -24,7 +24,7 @@ func buildLoadDerivedTypesSQL(pgVersion int64, typeNames []string) string { // This should not occur; this will not return any types typeNamesClause = "= ''" } else { - typeNamesClause = "= ANY($1)" + typeNamesClause = "= ANY($1::text[])" } parts := make([]string, 0, 10) @@ -169,7 +169,7 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Typ // the SQL not support recent structures such as multirange serverVersion, _ := serverVersion(c) sql := buildLoadDerivedTypesSQL(serverVersion, typeNames) - rows, err := c.Query(ctx, sql, QueryExecModeSimpleProtocol, typeNames) + rows, err := c.Query(ctx, sql, typeNames) if err != nil { return nil, fmt.Errorf("While generating load types query: %w", err) } From 2c8b60958cc75983e84b760b396a0c448fe60d7e Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 15 Feb 2026 10:41:21 +0100 Subject: [PATCH 2/2] Use text results --- derived_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/derived_types.go b/derived_types.go index bb2532cc3..89b9a77c1 100644 --- a/derived_types.go +++ b/derived_types.go @@ -169,7 +169,7 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*pgtype.Typ // the SQL not support recent structures such as multirange serverVersion, _ := serverVersion(c) sql := buildLoadDerivedTypesSQL(serverVersion, typeNames) - rows, err := c.Query(ctx, sql, typeNames) + rows, err := c.Query(ctx, sql, QueryResultFormats{TextFormatCode}, typeNames) if err != nil { return nil, fmt.Errorf("While generating load types query: %w", err) }