t8y2/dbx · error
custom type %s.%s is a pseudo type (typtype=%s)
Error message
custom type %s.%s is a pseudo type (typtype=%s)
What it means
getTypeDetails() resolves a user-defined type from the Kingbase/PostgreSQL catalog and maps its typtype code to a supported kind (b, c, d, e, r, m). If typtype holds a code outside that set — i.e. a pseudo type like 'p' (internal), 'S' (shadow), or an unrecognized vendor code — the driver cannot describe the type and throws this error instead of returning partial details.
Source
Thrown at agents/drivers/kingbase-go/kingbase_metadata.go:712
var typisdefined, typnotnull, typbyval bool
var typdefaultbin, typdefault, inputFn, outputFn, receiveFn, sendFn, analyzeFn, comment, collname, relkind sql.NullString
var typlen sql.NullInt64
var typtypmod int64
if err := rows.Scan(&oid, &typtype, &typisdefined, &typbasetype, &typnotnull, &typrelid, &typelem, &typcollation, &typdefaultbin, &typdefault, &typlen, &typbyval, &typalign, &typstorage, &typtypmod, &inputFn, &outputFn, &receiveFn, &sendFn, &analyzeFn, &comment, &relkind, &collname); err != nil {
return nil, fmt.Errorf("failed to read type %s.%s: %w", schema, name, err)
}
if err := rows.Close(); err != nil {
return nil, err
}
if !typisdefined {
return nil, fmt.Errorf("custom type %s.%s is not fully defined", schema, name)
}
if typelem != 0 {
return nil, fmt.Errorf("custom type %s.%s is an array companion type", schema, name)
}
kind, ok := customTypeKindFromCode(typtype)
if !ok {
return nil, fmt.Errorf("custom type %s.%s is a pseudo type (typtype=%s)", schema, name, typtype)
}
if relkind.Valid && relkind.String != "" && relkind.String != "c" {
return nil, fmt.Errorf("%s.%s is the auto-generated row type of a relation, not an independent custom type", schema, name)
}
properties := customTypeCommonProperties(inputFn, outputFn, receiveFn, sendFn, analyzeFn, typlen, typbyval, typalign, typstorage)
properties.DomainConstraints = []customTypeDomainConstraint{}
details := &customTypeDetails{
Name: name,
Schema: schema,
Kind: kind,
Comment: nullStringPtr(comment),
Members: []customTypeMember{},
Properties: properties,
}
var warnings []string
switch kind {View on GitHub (pinned to c0390bff16)
Solutions
- Request details only for types your application created (composite/enum/domain/range), not built-in or pseudo types
- Filter candidate types by typtype IN ('b','c','d','e','r','m') in your own catalog query before calling the details API
- Check the typtype code printed in the error against pg_type/sys_type documentation to identify what you actually resolved
- Skip the type in your enumeration logic and record it as unsupported
Example fix
// before
details, err := server.GetTypeDetails("public", "record") // pseudo type
// after
details, err := server.GetTypeDetails("public", "order_status") // real enum type Defensive patterns
Strategy: validation
Validate before calling
var ok = map[string]bool{"b":true,"c":true,"d":true,"e":true,"r":true,"m":true}
// before requesting details, check the typtype code from your own catalog query
if !ok[typtype] { skipType(schema, name, typtype) } else { requestDetails(schema, name) } Type guard
func isDescribeableTyptype(typtype string) bool {
switch typtype {
case "b", "c", "d", "e", "r", "m":
return true
}
return false
} Try / catch
details, err := server.GetTypeDetails(schema, name)
if err != nil {
var pseudo *PseudoTypeError // or strings.Contains(err.Error(), "is a pseudo type")
if strings.Contains(err.Error(), "pseudo type") {
log.Printf("skipping pseudo type %s.%s: %v", schema, name, err)
return nil
}
return err
} Prevention
- Enumerate candidate types with a typtype filter before calling the details API
- Never pass built-in/pseudo type names (record, any, void) to the type details API
- Keep the driver updated when upgrading Kingbase versions to pick up new typtype mappings
When it happens
Trigger: Calling the custom-type details/metadata API for a schema-qualified type whose sys_type/pg_type row has a typtype code not in {b,c,d,e,r,m}; e.g. requesting a pseudo type such as record (typtype 'p') or any, or a Kingbase-specific catalog entry with a new/unmapped code.
Common situations: Developer introspects a type picked from a generic catalog listing that includes pseudo types; the type name collides with a built-in pseudo type in a non-default schema; Kingbase version drift introduces a typtype code the driver doesn't recognize.
Related errors
- %s.%s is the auto-generated row type of a relation, not an i
- list custom types in schema %q: %w
- failed to read enum values: %w
- failed to read composite fields: %w
- list triggers in schema %q: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/a910ebd2f0a042cb.
Report an issue: GitHub.