jackc/pgx · error

unknown composite type field OID: %v

Error message

unknown composite type field OID: %v

What it means

Error "unknown composite type field OID: %v" thrown in jackc/pgx.

Source

Thrown at conn.go:1423

	if err != nil {
		return nil, err
	}

	var fields []pgtype.CompositeCodecField
	var fieldName string
	var fieldOID uint32
	rows, _ := c.Query(ctx, `select attname, atttypid
from pg_attribute
where attrelid=$1
	and not attisdropped
	and attnum > 0
order by attnum`,
		typrelid,
	)
	_, err = ForEachRow(rows, []any{&fieldName, &fieldOID}, func() error {
		dt, ok := c.TypeMap().TypeForOID(fieldOID)
		if !ok {
			return fmt.Errorf("unknown composite type field OID: %v", fieldOID)
		}
		fields = append(fields, pgtype.CompositeCodecField{Name: fieldName, Type: dt})
		return nil
	})
	if err != nil {
		return nil, err
	}

	return fields, nil
}

func (c *Conn) deallocateInvalidatedCachedStatements(ctx context.Context) error {
	if txStatus := c.pgConn.TxStatus(); txStatus != 'I' && txStatus != 'T' {
		return nil
	}

	if c.descriptionCache != nil {
		c.descriptionCache.RemoveInvalidated()

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at conn.go:1423 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04). Data as JSON: /data/errors/0f41ac4f065e0bca.json. Report an issue: GitHub.