jackc / pgx

PostgreSQL driver and toolkit for Go
MIT License
9.82k stars 802 forks source link

CockroachDB composite types #1912

Open cohortor opened 4 months ago

cohortor commented 4 months ago

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?

jackc commented 4 months ago

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