jackc / pgx

PostgreSQL driver and toolkit for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CockroachDB composite types

cohortor opened this issue · comments

Is your feature request related to a problem? Please describe.
As of version 23.1., CockroachDB supports composite types. However, conn.getCompositeFields() within conn.LoadType() is returning an empty list of fields, which ultimately results in "cannot find encode plan" errors later when attempting to use said type. The same code works great on Postgres.

Describe the solution you'd like
I would love to see CockroachDB composite types supported just as Postgres composite types are.

Describe alternatives you've considered
I have tried using pgtype.NewCompositeType, as per pgtype.composite_test.go, but apparently that family of APIs is missing from PGX v5.X onwards? Or was there perhaps some other recommended way to deal with composite types?

Does CockroachDB provide the pg_type and pg_attribute tables? That is where pgx is looking for the composite type definitions. See *Conn.getCompositeFields.