{"record":{"id":"4b9747368c84e842","repo":"JuliusBrussee/caveman","slug":"postgres-finish-tenant-schema-inspection-w","errorCode":null,"errorMessage":"postgres: finish tenant schema inspection: %w","messagePattern":"postgres: finish tenant schema inspection: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/postgresconfig/postgresconfig.go","lineNumber":251,"sourceCode":"\t}\n\tdefer tx.Rollback(ctx)\n\n\ttables, err := inspectTenantTables(ctx, tx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"postgres: inspect tenant tables: %w\", err)\n\t}\n\tforeignKeys, err := inspectTenantForeignKeys(ctx, tx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"postgres: inspect tenant foreign keys: %w\", err)\n\t}\n\tif violations := tenantSchemaViolations(tables, foreignKeys); len(violations) > 0 {\n\t\treturn fmt.Errorf(\"postgres: tenant schema isolation incomplete: %s\", strings.Join(violations, \"; \"))\n\t}\n\tif err := validateResolverSchema(ctx, tx); err != nil {\n\t\treturn err\n\t}\n\tif err := tx.Commit(ctx); err != nil {\n\t\treturn fmt.Errorf(\"postgres: finish tenant schema inspection: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc inspectTenantTables(ctx context.Context, queryer catalogQuerier) ([]tenantTableSchema, error) {\n\trows, err := queryer.Query(ctx, `\n\t\tSELECT c.relname,\n\t\t       NOT organization.attnotnull,\n\t\t       c.relrowsecurity,\n\t\t       c.relforcerowsecurity,\n\t\t       pol.oid IS NOT NULL,\n\t\t       coalesce(pol.polpermissive, false),\n\t\t       coalesce(pol.polcmd::text, ''),\n\t\t       coalesce(pol.polroles=ARRAY[0::oid], false),\n\t\t       coalesce(pg_get_expr(pol.polqual, pol.polrelid), ''),\n\t\t       coalesce(pg_get_expr(pol.polwithcheck, pol.polrelid), '')\n\t\tFROM pg_class c\n\t\tJOIN pg_namespace n ON n.oid=c.relnamespace","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/postgresconfig/postgresconfig.go#L233-L269","documentation":"Error \"postgres: finish tenant schema inspection: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/postgresconfig/postgresconfig.go:251 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the tenant schema inspection finalization error and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}