postgresql
Installation
SKILL.md
PostgreSQL
RLS Multi-tenancy Pattern
Non-negotiables
- RLS context is mandatory for any tenant-scoped query
- Context must be set inside the same transaction as the queries
- No fallbacks for tenant ID (fail fast if missing)
- Async-only DB access when using async frameworks
Setting RLS Context
RLS works only if the current transaction has the context set:
SET LOCAL app.current_tenant_id = '<tenant_uuid>';