Open
Description
To Reproduce
Use a Postgres type varchar[]
Create a query that queries it:
select mytype from mytype;
You'll see something like this in the generated code
// ...
type MyType struct {
ID *int32 `json:"id"`
RemoteIdentifiers pgtype.VarcharArray `json:"remote_identifiers"`
}
// ...
func (tr *typeResolver) newMyType() pgtype.ValueTranscoder {
return tr.newCompositeValue(
"mytype",
compositeField{name: "id", typeName: "int4", defaultVal: &pgtype.Int4{}},
// ...
compositeField{name: "remote_identifiers", typeName: "_varchar", defaultVal: &pgtype.VarcharArray{}},
// ...
)
}
Expected behavior
res, err := queries.FindMyType(ctx, 1)
// ...
var ids []string
_ = res.RemoteIdentifiers.AssignTo(&ids)
fmt.Printf("%+v", ids)
// to output a slice of string
Actual behavior
panic: runtime error: comparing uncomparable type pgtype.VarcharArray
goroutine 1 [running]:
github.com/jackc/pgtype.(*VarcharArray).Set(0xc0004e0038, {0xd200a0, 0xc0003f0180})
external/com_github_jackc_pgtype/varchar_array.go:29 +0x114
github.com/jackc/pgtype.assignToOrSet({0xeaffc0, 0xc0003f0140}, {0xd2b740, 0xc0004e0038})
external/com_github_jackc_pgtype/composite_type.go:171 +0xa2
github.com/jackc/pgtype.CompositeType.assignToPtrStruct({0x2, {0xd8047e, 0x6}, {0xc00005c200, 0x5, 0x5}, {0xc00051e410, 0x5, 0x5}}, {0xbf5c80, ...})
external/com_github_jackc_pgtype/composite_type.go:212 +0x3d7
github.com/jackc/pgtype.CompositeType.AssignTo({0x2, {0xd8047e, 0x6}, {0xc00005c200, 0x5, 0x5}, {0xc00051e410, 0x5, 0x5}}, {0xbf5c80, ...})
external/com_github_jackc_pgtype/composite_type.go:150 +0x1fb
See also: jackc/pgtype#217
Metadata
Metadata
Assignees
Labels
No labels
Activity