{"record":{"id":"5277b16374fe79c2","repo":"t8y2/dbx","slug":"s-s-is-the-auto-generated-row-type-of-a-relation-5277b1","errorCode":null,"errorMessage":"%s.%s is the auto-generated row type of a relation, not an independent custom type","messagePattern":"(.+?)\\.(.+?) is the auto-generated row type of a relation, not an independent custom type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/vastbase-go/vastbase_metadata.go","lineNumber":645,"sourceCode":"\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 {\n\tcase customTypeKindEnum:\n\t\tdetails.Members, err = s.customTypeEnumMembers(queries.enumMembers, oid)\n\t\tif err != nil {","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/vastbase-go/vastbase_metadata.go#L627-L663","documentation":"The Vastbase driver's custom type detail lookup rejects types whose pg_class relkind indicates the type is the auto-generated row (composite) type of a relation such as a table or view, rather than a standalone CREATE TYPE object. Every table in Vastbase implicitly owns a same-named composite type in the catalog, so the driver filters those out to report only genuine custom types. This prevents misleading type metadata being returned for something that is really a table's row type.","triggerScenarios":"Calling the custom type details/list API (GetCustomTypeDetails or listing custom types) for a name that resolves to a catalog entry where typtype='c' but the associated pg_class.relkind is not 'c' (e.g. 'r' table, 'v' view) — i.e. asking for a table/view's implicit row type as if it were a custom type.","commonSituations":"Passing a table or view name instead of a composite type name; a composite type name that collides with a table name in the same schema; enumerating a schema and then requesting details on an entry that is actually a relation row type.","solutions":["Verify the name refers to an object created with CREATE TYPE ... AS (...) and not a table/view; use the actual composite type name.","If you want table structure, use the table metadata API (columns/list tables) instead of the custom type API.","Rename either the type or the relation if they collide in the same schema, then retry.","Filter your inputs to exclude relation names before calling the custom type details API."],"exampleFix":"// before\n// assuming \"public.address\" is a table, fetching its row type as a custom type\ndetails, err := server.CustomTypeDetails(\"public\", \"address\")\n\n// after\n// use the table metadata API for relations\n\\ncolumns, err := server.ListColumns(\"public\", \"address\")","handlingStrategy":"validation","validationCode":"// check the catalog before requesting custom type details\nvar typtype, relkind string\nerr := db.QueryRow(`SELECT t.typtype, COALESCE(c.relkind,'') FROM pg_type t LEFT JOIN pg_class c ON c.oid = t.typrelid WHERE t.typname=$1 AND t.typnamespace=$2::regnamespace`, name, schema).Scan(&typtype, &relkind)\nif err == nil && relkind != \"\" && relkind != \"c\" {\n    // it's a table/view row type — use table metadata instead\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"auto-generated row type\") {\n        // fall back to table/column metadata API\n    } else {\n        return err\n    }\n}","preventionTips":["Distinguish tables/views from custom types before calling the type-details API.","Maintain a naming convention so composite types don't collide with relation names.","Validate input names against a listing of actual custom types first."],"tags":["vastbase","metadata","custom-types"],"backgroundTag":"not-a-custom-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"}