Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 5 min read Release mediumAdept

What is new in PostgREST v11.1?

PostgREST 11.1 lets impersonated JWT roles (anon, authenticated, service_role) carry Postgres settings via ALTER ROLE ... SET, applied after a NOTIFY pgrst 'reload config'. That enables per-role statement_timeout and pg_plan_filter cost limits, where the cost limit rejects expensive queries at planning time but needs careful tuning. Transaction isolation is now configurable per function or role, alongside bulk JSON inserts that respect column defaults and new any/all filter modifiers. Breaking changes from v10 are small: the Range header is ignored on non-GET requests and Prefer: params=multiple-objects is dropped for RPC, and usage logs show almost no projects relied on either.

Related posts

  • PostgREST 9

    Supabase mediumAdept

    PostgREST 9 adds inner-join resource embedding via the `!inner` keyword, so top-level rows can be filtered by conditions on an embedded table (e.g. messages filtered by users.username). Functions can now accept a single unnamed JSON parameter, which lets webhooks such as Postmark bounce notifications POST raw payloads straight to an rpc endpoint. PostgreSQL 14 compatibility forced a breaking change: per-claim and per-header settings are replaced by `request.jwt.claims` and `request.headers` JSON settings, so custom auth functions must be updated. Supabase's built-in auth helpers already handle this.

  • PostgREST 12.2: Prometheus metrics

    Supabase mediumAdept

    PostgREST 12.2 adds Prometheus-compatible metrics for its schema cache and connection pool, such as pgrst_db_pool_timeouts_total, to help diagnose problems like pool starvation. Function-level settings such as statement_timeout are now "hoisted" and applied per transaction when the function is called through RPC, so a single function can have its own timeout without changing the API role for every statement. Other settings can be added to the hoisted list via db-hoisted-tx-settings. A new max-affected Prefer header caps how many rows a mutation can touch, returning PGRST124 when the cap is exceeded under strict handling.

  • PostgREST Aggregate Functions

    Supabase mediumAdept

    PostgREST v12 adds on-the-fly aggregate functions (avg, count, max, min, sum) to its API. You apply them by appending the function to a column in the select parameter, and any non-aggregated columns become implicit GROUP BY columns. Aggregates compose with column renaming, filtering, embedded resources and spread relationships, so you can group movies by a related director's country, for example. Because aggregates bypass pagination limits and can be abused for denial of service, the feature is disabled by default. Before enabling it, set per-role query cost ceilings with pg_plan_filter.

  • Cracking PostgreSQL Interview Questions

    Supabase mediumAdept

    Interview preparation for the transactional side of PostgreSQL, organized around five areas: data modeling, indexes, views, roles and functions. It covers modeling 1-1, 1-M and M-M relationships with foreign keys and join tables, and using rich types like JSONB, enums and timestamptz. On performance and access control it explains B-tree and other index types, comparing plans with EXPLAIN ANALYZE, auto-updatable views, GRANTs to PUBLIC, and row level security policies. It also shows PL/pgSQL trigger functions for auto-updating timestamps, advises thinking in sets rather than loops, and introduces CTEs, all with short SQL examples.

  • PostgREST v10: EXPLAIN and Improved Relationship Detection

    Supabase mediumAdept

    PostgREST v10 adds HTTP-level EXPLAIN support: requests with the `application/vnd.pgrst.plan` media type, or supabase-js's `explain()` transform, return the PostgreSQL execution plan for reads, writes and RPC, which helps verify that RLS policies are applied and gives you the pg_stat_statements query identifier. Relationship detection also improves. One-to-one relationships are inferred from unique or primary keys on foreign keys, and "computed relationships" use inlinable SQL functions to define joins on views and materialized views that lack foreign keys. A breaking change now requires a join table's primary key to include both foreign key columns before it is detected as many-to-many. EXPLAIN is gated behind `db-plan-enabled` and intended only for development.

The quest for software engineering knowledge.

Look:
Layout: