Alpha. Contributes ctx.postgresAdmin — a pg client that bypasses
RLS, for full-table access. The direct-connection counterpart to
withSupabaseAdminClient, and the deliberate opt-out from the guardrails
withPostgresClient (@supabase/server/middleware/postgres) enforces.
Queries run as-is, as the role in the connection string: no claim injection,
no role switching, no wrapping transaction. Whatever that role may read, the
caller may read.
Unlike withPostgresClient this declares no upstream prerequisite — it
never looks at ctx.jwtClaims, so it composes in any auth mode, including
auth: 'secret' and auth: 'none':
Authorization is yours now. RLS is not consulted, so any per-user
scoping has to be a where clause you write. Reach for
withPostgresClient unless you specifically need to cross user
boundaries.
Runtime note.pg needs raw TCP, so this runs on Node/Deno (including
the Supabase Edge runtime), not on Workers-style isolates.
The composable middleware surface tracks @supabase/middleware 0.x — entry
shapes, context keys, and config options may change between 0.x releases.
Alpha. Contributes
ctx.postgresAdmin— apgclient that bypasses RLS, for full-table access. The direct-connection counterpart towithSupabaseAdminClient, and the deliberate opt-out from the guardrailswithPostgresClient(@supabase/server/middleware/postgres) enforces.Queries run as-is, as the role in the connection string: no claim injection, no role switching, no wrapping transaction. Whatever that role may read, the caller may read.
Unlike
withPostgresClientthis declares no upstream prerequisite — it never looks atctx.jwtClaims, so it composes in any auth mode, includingauth: 'secret'andauth: 'none':Compose both halves when a handler needs each in turn — they share one pool, and
ctx.postgresstays RLS-scoped regardless:The composable middleware surface tracks
@supabase/middleware0.x — entry shapes, context keys, and config options may change between 0.x releases.