jackc / jackc/pgx

CockroachDB composite types

Open
#1,912 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

**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?

Contributor guide

Open the contributing guide

Research direction

Start by tracing conn.LoadType() and conn.getCompositeFields() to see how composite metadata is loaded for CockroachDB. Compare that path with PostgreSQL support and inspect pgtype.composite_test.go for existing coverage and expected behavior. Done means CockroachDB composite fields are discovered and the later encode-plan error is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.