{"record":{"id":"a910ebd2f0a042cb","repo":"t8y2/dbx","slug":"custom-type-s-s-is-a-pseudo-type-typtype-s","errorCode":null,"errorMessage":"custom type %s.%s is a pseudo type (typtype=%s)","messagePattern":"custom type (.+?)\\.(.+?) is a pseudo type \\(typtype=(.+?)\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/kingbase-go/kingbase_metadata.go","lineNumber":712,"sourceCode":"\tvar typisdefined, typnotnull, typbyval bool\n\tvar typdefaultbin, typdefault, inputFn, outputFn, receiveFn, sendFn, analyzeFn, comment, collname, relkind sql.NullString\n\tvar typlen sql.NullInt64\n\tvar typtypmod int64\n\tif 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 {\n\t\treturn nil, fmt.Errorf(\"failed to read type %s.%s: %w\", schema, name, err)\n\t}\n\tif err := rows.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\tif !typisdefined {\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s is not fully defined\", schema, name)\n\t}\n\tif typelem != 0 {\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s is an array companion type\", schema, name)\n\t}\n\tkind, ok := customTypeKindFromCode(typtype)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s is a pseudo type (typtype=%s)\", schema, name, typtype)\n\t}\n\tif relkind.Valid && relkind.String != \"\" && relkind.String != \"c\" {\n\t\treturn nil, fmt.Errorf(\"%s.%s is the auto-generated row type of a relation, not an independent custom type\", schema, name)\n\t}\n\n\tproperties := customTypeCommonProperties(inputFn, outputFn, receiveFn, sendFn, analyzeFn, typlen, typbyval, typalign, typstorage)\n\tproperties.DomainConstraints = []customTypeDomainConstraint{}\n\tdetails := &customTypeDetails{\n\t\tName:       name,\n\t\tSchema:     schema,\n\t\tKind:       kind,\n\t\tComment:    nullStringPtr(comment),\n\t\tMembers:    []customTypeMember{},\n\t\tProperties: properties,\n\t}\n\n\tvar warnings []string\n\tswitch kind {","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/kingbase-go/kingbase_metadata.go#L694-L730","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ndetails, err := server.GetTypeDetails(\"public\", \"record\") // pseudo type\n// after\ndetails, err := server.GetTypeDetails(\"public\", \"order_status\") // real enum type","handlingStrategy":"validation","validationCode":"var ok = map[string]bool{\"b\":true,\"c\":true,\"d\":true,\"e\":true,\"r\":true,\"m\":true}\n// before requesting details, check the typtype code from your own catalog query\nif !ok[typtype] { skipType(schema, name, typtype) } else { requestDetails(schema, name) }","typeGuard":"func isDescribeableTyptype(typtype string) bool {\n  switch typtype {\n  case \"b\", \"c\", \"d\", \"e\", \"r\", \"m\":\n    return true\n  }\n  return false\n}","tryCatchPattern":"details, err := server.GetTypeDetails(schema, name)\nif err != nil {\n  var pseudo *PseudoTypeError // or strings.Contains(err.Error(), \"is a pseudo type\")\n  if strings.Contains(err.Error(), \"pseudo type\") {\n    log.Printf(\"skipping pseudo type %s.%s: %v\", schema, name, err)\n    return nil\n  }\n  return err\n}","preventionTips":["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"],"tags":["metadata","custom-types","catalog","kingbase"],"backgroundTag":"unsupported-pseudo-type","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}