Skip to content

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

Supabase 3 min read Release mediumAdept

PostgREST 13

PostgREST 13 adds spread syntax for to-many relationships so one-to-many and many-to-many joins can be returned as flat JSON arrays, automatic to_tsvector conversion that enables full text search on text and json/jsonb columns (backed by a GIN index on the expression), and a maxAffected limit that throws an error when an update, delete or rpc touches too many rows. For observability, responses now carry Content-Length and a Proxy-Status header with the PostgREST error code. Breaking changes: JWT kid claims are validated against the configured JWKS, and schemas in db-schemas and db-extra-search-path must exist, so schema drops should update the search path in the same transaction.

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 11 pre-release

    Supabase mediumAdept

    PostgREST 11's pre-release, available through the Supabase CLI, adds three querying features. A spread operator (`...table(cols)`) flattens embedded related-table columns into the parent object. Ordering by a related table's column is now supported, as are anti-joins via `is.null` filters on embedded resources. Spread and related ordering work only for one-to-one and many-to-one relationships for now. A `not.is.null` filter provides a more flexible alternative to the `!inner` modifier because it can be combined with `or` filters.

  • pg_jsonschema: JSON Schema support for Postgres

    Supabase mediumAdept

    pg_jsonschema is a Postgres extension that validates `json` and `jsonb` values against a JSON Schema through two functions, `json_matches_schema` and `jsonb_matches_schema`. Used inside a check constraint, it keeps the flexibility of document columns, such as storing raw webhook payloads instead of normalizing them into many joined tables, while still enforcing type, required-field and no-extra-properties rules. In the example, an unconstrained `json` column handled only 2 of 8 test inputs correctly, and the schema-backed check constraint handled all 8. It is available on Supabase via `create extension pg_jsonschema` or through Docker Compose.

  • PostgREST 12

    Supabase mediumAdept

    PostgREST 12 caches validated JWTs using the token's exp claim as the cache lifetime, cutting server-side JWT handling in the example from about 148ms to 14ms per request. A new Server-Timing response header reports per-phase durations for jwt, parse, plan, transaction and response. The release also adds aggregate functions (avg, count, max, min, sum) with implicit group-by through the select clause, plus media type handlers that let SQL functions return custom content types such as HTML directly from Postgres.

  • SQL or NoSQL? Why not use both (with PostgreSQL)?

    Supabase mediumAdept

    PostgreSQL's JSONB columns let an app store nested, variable-length data (here, a daily food, water and exercise log) as a single row instead of spreading it across several normalized tables, while keeping SQL available for analysis. A worked example builds a calendar table with JSONB log fields and inserts a whole day in one statement. It then uses jsonb_array_elements with the -> and ->> operators to flatten the arrays into rows. Because aggregates cannot wrap set-returning functions, the flattened query goes into a CTE before summing daily calories or filtering for specific items.

The quest for software engineering knowledge.

Look:
Layout: