JuliusBrussee/caveman · error

postgres: finish tenant schema inspection: %w

Error message

postgres: finish tenant schema inspection: %w

What it means

Error "postgres: finish tenant schema inspection: %w" thrown in JuliusBrussee/caveman.

Source

Thrown at shared/platform/postgresconfig/postgresconfig.go:251

	}
	defer tx.Rollback(ctx)

	tables, err := inspectTenantTables(ctx, tx)
	if err != nil {
		return fmt.Errorf("postgres: inspect tenant tables: %w", err)
	}
	foreignKeys, err := inspectTenantForeignKeys(ctx, tx)
	if err != nil {
		return fmt.Errorf("postgres: inspect tenant foreign keys: %w", err)
	}
	if violations := tenantSchemaViolations(tables, foreignKeys); len(violations) > 0 {
		return fmt.Errorf("postgres: tenant schema isolation incomplete: %s", strings.Join(violations, "; "))
	}
	if err := validateResolverSchema(ctx, tx); err != nil {
		return err
	}
	if err := tx.Commit(ctx); err != nil {
		return fmt.Errorf("postgres: finish tenant schema inspection: %w", err)
	}
	return nil
}

func inspectTenantTables(ctx context.Context, queryer catalogQuerier) ([]tenantTableSchema, error) {
	rows, err := queryer.Query(ctx, `
		SELECT c.relname,
		       NOT organization.attnotnull,
		       c.relrowsecurity,
		       c.relforcerowsecurity,
		       pol.oid IS NOT NULL,
		       coalesce(pol.polpermissive, false),
		       coalesce(pol.polcmd::text, ''),
		       coalesce(pol.polroles=ARRAY[0::oid], false),
		       coalesce(pg_get_expr(pol.polqual, pol.polrelid), ''),
		       coalesce(pg_get_expr(pol.polwithcheck, pol.polrelid), '')
		FROM pg_class c
		JOIN pg_namespace n ON n.oid=c.relnamespace

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Fix the tenant schema inspection finalization error and retry.

When it happens

Trigger: Thrown at shared/platform/postgresconfig/postgresconfig.go:251 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/4b9747368c84e842. Report an issue: GitHub.