MINORCloser to PostgREST

Postrust 3.4.0

PostgREST conformance goes from 1414 to 1486 of 1499 cases on the full contract, and every status code agrees. Most of the difference was bugs, fixed in both modes: embeds through junctions and views, headers such as the count after a write and a handler’s own Content-Type, representations and casts inside embeds, upsert statuses on views and partitions. The rest is PostgREST behaviour that compatibility mode now matches and default mode keeps away from on purpose, such as a select cut short at a stray character. A view now inherits its table’s primary key, and a RETURNS TABLE function honours select; the changelog lists what that changes. GraphQL: an enum value beginning with null, true or false parses, which brings Hasura conformance to 455 of 468. Released beside it: postrust-worker 1.4.0.

3.3.0: error handling for an API that replaces another. A missing grant is a 403 for a signed-in caller rather than a 401 that signs them out, as PostgREST answers it. A function that finds nothing (P0002) is a 404, and PGRST_DB_ERROR_STATUS sets the status of any SQLSTATE. A RAISE sqlstate 'PGRST' can write the whole response body, and PGRST_RPC_UNWRAP gives RPC results PostgREST’s shape without the rest of compatibility mode, which keeps PostgREST’s answers throughout and is now documented in full. Released beside it: postrust-worker 1.3.0 and postrust-proxy 2.0.2, which requires the fixed hickory release.

3.2.0: a shared Apollo Federation entity type says @shareable once, on the type, and hyper moves to 1.12, which drops the unmaintained pin-utils (RUSTSEC-2026-0441) from the build.

3.1.1: shared Apollo Federation entity types emit @shareable on the object type (type Product @key(fields: "id") @shareable) as well as on each non-key field, satisfying Apollo’s subgraph compatibility suite check, and every crate’s manifest and README link directly to its matching documentation routes. Released beside it: postrust-worker 1.2.1 and postrust-proxy 2.0.1.

3.1.0: PGRST_DB_ERRORS_VERBATIM answers database errors in PostgreSQL’s own words -- SQLSTATE, message, detail and hint -- without the rest of compatibility mode, so a function’s RAISE EXCEPTION reaches the person using the app instead of “Database error”. List the SQLSTATEs to pass through, such as P0001,PT*, or set it to true for all of them. Off by default; postrust-worker 1.2.0 reads it too.

3.0.0: asymmetric JWTs and keys fetched from your identity provider, routes of your own that run as their caller under row-level security, and OpenTelemetry traces and metrics. A major release for the Rust API -- sqlx 0.9, Rust 1.94 -- not for the HTTP one: a deployment that runs the server or the image upgrades by changing the tag. It carries 2.4.1’s security fixes. Released beside it: postrust-worker 1.1.0 and postrust-proxy 2.0.0, whose API takes a sqlx pool.

2.4.1: a security release, and every deployment should upgrade. It fixes an SQL injection through a cast in select and a deeply nested request that crashes the server, both reachable without a token, and hardens two related places. The security advisories have the details. No API change; the Cloudflare Workers adapter moves to postrust-worker 1.0.1 with the same fixes.

2.4.0: GraphQL now picks up a migration when it is announced with NOTIFY pgrst, as REST always has. A write a view cannot take is answered 405 with Allow rather than 500, and errors the schema raises on purpose no longer fill the error log. No breaking change: cargo semver-checks against 2.3.2 passes for every stable crate.

2.3.2 updated rustls to 0.23.46 and quinn-proto to 0.11.18, which fix seven RustSec advisories, among them a remote peer able to panic quinn-proto and a Debug impl in rustls that printed TLS secrets. The changelog lists each advisory.

2.3.1: the Cloudflare Workers adapter is released as postrust-worker 1.0.0, and keeps semver from here, on a version of its own. Its promise covers what a deployment sees rather than a Rust API: the variables it reads, the bindings it looks for, its endpoints and defaults. Nothing else changed; the other crates and the images carry 2.3.0’s code as 2.3.1.

2.3.0: the Cloudflare Workers adapter serves the REST API over Hyperdrive, on the server’s own request pipeline. A write the response refuses is rolled back, as PostgREST rolls it back. And two GraphQL fixes, found by running two Postrust subgraphs behind Apollo Router for a post on Federation, first cut as 2.2.1 and released here instead. No breaking change: cargo semver-checks against 2.2.0 passes for every stable crate. 2.2.0, below, is the release that made AWS Lambda and a NOINHERIT authenticator work.

Postrust 3.0.0

Added in 3.0.0

Asymmetric JWTs

PGRST_JWT_SECRET may be a JWK or a JWKS: RS256/384/512, PS256/384/512, ES256, ES384 and EdDSA, beside HMAC. The algorithm comes from the key, never from the token, so neither alg: none nor an HS256 token signed with an RSA public key gets through.

Keys from your identity provider

PGRST_JWT_JWKS_URL fetches the key set from Supabase Auth, Auth0, Clerk, Cognito or Keycloak and keeps it current: on its Cache-Control max-age, and once more when a token names a kid not yet held, so a rotated-in key works without a restart and a withdrawn one stops working. If no set has ever loaded, tokens are refused and /_/ready answers 503. PGRST_JWT_ISS pins the issuer.

Routes of your own, as the caller

postrust_server::Builder nests your own axum routers beside the API in a crate of your own, no fork. A User extractor authenticates as REST does, and AppState::begin_as starts a transaction as that caller -- the role, the claims, the request settings -- so your SQL runs under the same row-level security policies.

OpenTelemetry and Prometheus

A span per request with child spans for authentication, planning, each statement and rendering; W3C traceparent in and x-request-id out; PGRST_LOG_FORMAT=json. With the otel feature, in the published images, traces and metrics export over OTLP, and /metrics serves Prometheus text on the admin port.

Changed in 3.0.0

sqlx 0.9 and Rust 1.94

The database driver moves to sqlx 0.9, whose types are part of the Rust API, and the minimum supported Rust version to 1.94. SQL built at runtime in your own code needs sqlx::AssertSqlSafe.

JwtConfig and AppState are non-exhaustive

So that adding a field is a minor release from here on. Build them with postrust_engine::jwt_config and AppState::new instead of struct literals.

A JWT secret that cannot be used stops start-up

A secret that starts with { and is not a usable JWK or JWKS, or an http JWKS URL to a host that is not loopback, is a configuration error rather than a server that refuses every token.

GraphQL transactions are set up as REST's are

A role's statement_timeout and isolation level from PGRST_ROLE_SETTINGS, and app.settings.*, now apply to GraphQL operations too. The search_path is left as before.

Upgrading: the server and the image need nothing but the new tag. Code built on the crates needs Rust 1.94 and, if it uses sqlx itself, sqlx 0.9. The changelog has the full upgrade note.

Postrust 2.4.1

Security fixes in 2.4.1

SQL injection through a cast in select

The type after :: in a select (?select=price::text) was written into the statement as the client sent it, and the parser accepted spaces there, so words a client appended reached the database as SQL, run as the request's role. A cast is now one type name, or one of the SQL standard's multi-word names such as double precision; anything else is a 400 PGRST100. Every cast PostgREST accepts is still accepted.

A deeply nested request no longer crashes the server

A select or an or=/and= filter nested a few thousand levels deep, about 15 KB of query string, overflowed the stack, and a stack overflow aborts the whole process. Nesting past 64 levels is now refused with 400 PGRST100 before it is parsed.

Hardening: string literals and the none role

JSON path keys, and the keys GraphQL writes into json_build_object, are written as E'...' when they contain a backslash, so they stay one literal even where standard_conforming_strings is off. A token whose role claim is "none" or empty names no role: PostgreSQL reads none as no role at all, which ran the request as the authenticator. Neither is reachable on default settings or without a signed token.

Upgrading: nothing to change. A select that casts to something other than a type name, or nests more than 64 levels, is now a 400. A token whose role is "none" or empty runs as the anonymous role. 2.4.0 never reached crates.io, so crates.io users get its changes, below, with this release.

Postrust 2.4.0

Added in 2.4.0

GraphQL follows a schema reload

NOTIFY pgrst, 'reload schema' refreshed the REST schema cache only, so a table a migration added was missing from GraphQL until a restart. Each reload now rebuilds the GraphQL schema beside the old one and swaps it in whole; a rebuild that fails leaves the previous schema serving. Enum tables are read again, subscriptions opened before the reload keep receiving notifications, and a server that could not build its GraphQL schema at start-up builds it on the next reload.

Allow on every 405

A 405 now says what the resource does take, as RFC 9110 requires: the same Allow an OPTIONS gives. A function that writes called with GET, and a PUT with filters it cannot take, were 405s without one.

Fixed in 2.4.0

A write a view cannot take is a 405, not a 500

A view PostgreSQL cannot write through, such as a join with no INSTEAD OF trigger, refuses every write with "cannot update view", and that was answered 500 Database error. It is now 405 PGRST117 with Allow and a message naming the view. A write to a materialized view, a 400 before, is a 405 too.

Refusals leave the error log

Every failed query was logged at error, so a schema answering "not found" by raising PT404 filled the log. PT statuses, constraint violations, bad input values and a write the view cannot take are now logged at debug. Faults stay at error, including those answered with a 4xx: SQL the planner got wrong, a table dropped behind the schema cache, a missing grant, a bare RAISE EXCEPTION.

Security: five dependency updates

rustls-webpki 0.103.16, webpki-roots and webpki-root-certs 1.0.11, ctutils 0.4.6 and tokio 1.54.1, past RustSec advisories published since 2.3.2, among them certificate verification that could accept distrusted intermediates. The changelog lists each advisory.

Upgrading: nothing to change. A log alert on Query error stops firing for refusals such as a PT404 or a duplicate key; faults still log at error. A write to a view that cannot take it is a 405 where it was a 500 (a 400 for a materialized view), and /v1/graphql on a server that could not build its GraphQL schema answers unexpected rather than 404.

Postrust 2.3.0

Added in 2.3.0

The Cloudflare Workers adapter works

postrust-worker 0.7.0 serves the REST API in a Worker and reaches PostgreSQL through Hyperdrive. Every request runs in a transaction that switches to the token's role and sets its claims, as on the server; the schema cache lives in Workers KV and is refreshed by a Cron Trigger or an authenticated POST /_/reload. It scores 1422 of PostgREST's 1499 conformance cases in workerd. REST only.

postrust-engine, the request pipeline with no web framework

The REST pipeline came out of the server: handle(&state, request) takes an http::Request and returns an http::Response. The server is an axum wrapper around it, and the Worker runs the same code. Server throughput is unchanged, measured on pinned cores, and the binary is 1% larger.

A driver-neutral database interface, and statement pipelining

postrust_core::db's Db and Tx traits are implemented by sqlx's pool and by PgSocketDb, which speaks the wire protocol through tokio-postgres over any socket. A differential test suite holds the two to identical answers. Over the socket driver a plain read is one flight to the database after connecting, where it was five, and a write two: from Singapore to a database in Delhi, through Hyperdrive, a read went from 380 to 240 ms.

Fixed in 2.3.0

A write the response refuses is rolled back

Refusals that can only be made after the statement has run — more rows than Prefer: max-affected allowed, several rows where one object was asked for, a PUT whose body names another row, a function setting an invalid response.status or response.headers — were made after the transaction had been committed, so the client was told the request failed while every row stayed changed. PostgREST rolls these back, and now so does Postrust, on either driver.

A schema reload no longer deadlocks a request in flight

A request held the schema cache's read lock from planning to the end of its query and took it again along the way. A reload (NOTIFY pgrst) queued in between waited on the request while the request waited on the reload, and every request after them queued behind both until the server was restarted. The lock is now released before the query runs.

A write refused at COMMIT is reported as what it is

A deferred constraint fails at COMMIT, and that was answered 500 Service temporarily unavailable, as if the pool had failed. It is now the database's error with its SQLSTATE: a deferred foreign key violation is a 409, as an immediate one is.

A header a pre-request function sets reaches a read

db-pre-request can set response headers and status on any request, and PostgREST honours them on a GET — a Cache-Control, say. They were read back only after a function call or a write.

__typename inside a relationship or an aggregate

Asking for __typename anywhere below the root — on an object or array relationship, the rows a mutation returned, or inside an aggregate's functions such as max { __typename id } — failed the whole query with column "__typename" does not exist; only the root and aggregate nodes answered it. Apollo Client adds __typename to every selection set by default, and a Federation router asks for it on every entity reference it follows, so a query that crossed from one subgraph to another through a relationship failed. It is now answered by the schema, as it is at the root.

A GraphQL token that does not verify is refused

A token signed with the wrong key, expired, or not a bearer token at all was served as the anonymous role over GraphQL, where REST refuses it with 401. The client kept getting answers, as someone else, with nothing to say why its rows had gone. It is now refused as invalid-jwt, as Hasura refuses it, and a verified token naming no role on a server with no anonymous role as jwt-missing-role-claims. With no JWT secret configured the Authorization header is still ignored, so a router forwarding it to every subgraph is unaffected.

Upgrading: nothing to change, unless a GraphQL client relied on an expired or invalid token being answered anonymously; it now gets an invalid-jwt error and should drop the token or refresh it. A db-pre-request function that sets response headers now has them applied to reads too, as PostgREST does. The public Rust API gains a crate, postrust-engine, and postrust_core::db, and loses nothing. Conformance is unchanged: PostgREST 1424/1499, Hasura 454/468. The README, docs and site also stop saying what nobody measured — “serverless-first”, “5–20 ms cold starts”, a ~5 MB binary.

Measured, not asserted

These are the figures from the most recent recorded runs: PostgREST on 2026-11-18 at commit 730b801, Hasura on 2026-11-18 at commit 1bb4dce. This page reads them from the run’s own record, so they move when the suites are re-run and not otherwise. Both were run on this release’s code, and score what 2.2.0 scored. Through the socket driver the Worker uses, PostgREST’s suite agrees on every case but one, a function that asks whether it runs as a named prepared statement; see the conformance notes.

Neither harness interprets a test expectation. The reference implementation’s live response is the oracle, so a mistake in the extractor shows up as a case both servers answer the same way rather than as a false failure. Of the 457 Hasura cases counted at that level, 326 agree about data and 131 agree because both servers refuse — a distinction worth keeping, since counting only the first would score a case where Hasura itself raises an error as a failure to match it.

Federation is measured by a third suite that is not ours: Apollo’s subgraph compatibility suite, run against a fixture pinned to Apollo’s own schema and data. Its required capabilities gate the build. The optional ones Postrust does not yet support are listed under Known gaps below rather than left for someone else to find.

Earlier Release Notes (Postrust 2.2.0 – 1.0.0)▾

Postrust 2.2.0

The front door, measured

h2spec
145/146
passed, 0 failed
1 skipped, against the HTTP/2-only listener
Autobahn
0
cases the tunnel made worse than no tunnel
over 517 cases, 499 of 509 OK

Three suites, none of them ours. HTTP Garden, a differential fuzzer that sends a payload through a proxy and shows how a set of origin servers parsed what came out, is what found the hop-by-hop defect. h2spec speaks HTTP/2 at the listener. Autobahn is the reference WebSocket suite.

The Autobahn figure needs its method stated, because the obvious number would be misleading. Postrust splices two upgraded byte streams and never parses a WebSocket frame, so most of what the suite scores belongs to the origin behind it, not to the proxy. Every run therefore has a twin that bypasses the proxy entirely, and the figure above is the difference: cases that are worse through the tunnel than without it. Of 517 cases, 1 fails — and fails identically with no proxy in the path, so it is the origin’s.

One family of cases is excluded from that comparison and named on every run rather than dropped quietly: those that send a valid message, then an invalid frame, and expect the echo of the first. The origin fails the connection without flushing that echo when both arrive in one read, and any relay coalesces what a client chopped — measured directly, with no proxy involved, the same bytes sent octet-wise echo and sent as one write do not. Which member of the family trips varies between runs, so the 8 of them are left out of the OK count above rather than making it move between runs. On this run none of them was worse than the baseline.

What 2.2.0 means

A minor release. The public Rust API gains postrust_server::build, App and Host, a graphql feature and schema_cache::enum_values, and loses nothing: cargo semver-checks against 2.1.0 passes for every stable crate. Everything else here is behaviour you see by running Postrust.

postrust-proxy and postrust-worker stay at 0.6.0: neither changed.

Added

postrust_server::build, for serving the server's router elsewhere

Everything between a loaded configuration and a router answering requests — the pool, the schema cache, REST, GraphQL and the layers around them — is a library function, with a Host saying what the host can do beyond answering requests. The binary and the Lambda adapter both serve what it returns. A graphql feature on postrust-server serves GraphQL without the admin UI, which admin-ui still implies.

The Lambda adapter is tested where it runs

A CI job builds the function with cargo-lambda and runs it in AWS's own provided:al2023 image, which carries the Lambda runtime emulator, against PostgreSQL with row-level security and a NOINHERIT authenticator: filters, writes allowed and refused, per-user rows over REST and GraphQL, functions seeing the token's role and claims, and the table state the writes leave behind.

Both came out of checking what the website said about serverless before a post repeated it: #48 for Lambda and #49 for the authenticator. How to set the authenticator up is in the authentication docs.

Fixed

The Lambda adapter serves the server's router

It carried a request path of its own, and nothing ran it. That path never bound a query's parameters, so every filter and every write failed with bind message supplies 0 parameters; and it never switched to the token's role or set its claims, so a function connected as a superuser answered every caller with every row, row-level security or not, including callers whose token named a role that does not exist. It now hands the server's router to the Lambda runtime: REST, GraphQL with Federation, JWT, the role switch and the claims behave exactly as they do in the binary.

A NOINHERIT authenticator sees the schema

The authenticator PostgREST recommends logs in with no privileges of its own and becomes the token's role for each request. The schema cache read information_schema, whose views show a connection only what it can use without switching role — through that authenticator, nothing — so every table was not found, on the server and on Lambda alike. Tables, columns, write permissions, data representations and GraphQL enum tables are now read for the roles the connection can become. Under a superuser or an inheriting authenticator the schema cache is unchanged, compared table by table and column by column over PostgREST's fixture schema.

Enum labels and table comments come from the right object

Enum labels were looked up by type name alone, so same-named enums in two schemas could swap labels, and PostgREST's own fixture — which declares an enum named bit — had its bit(5) column reported as an enum of one and two. A table's description was looked up by OID alone, so a function that happened to share the table's OID lent it its comment. Both are now looked up on the object itself.

The documentation stops promising a Workers adapter

The docs and website described Cloudflare Workers support with Hyperdrive that compiles to WebAssembly. postrust-worker is a stub that answers that it is a stub, and does not currently build for WebAssembly; the pages now say so, and what it will take.

[Superseded in 2.3.0: postrust-worker builds to wasm32 and serves the REST API over Hyperdrive. Cloudflare Workers docs.]

Upgrading

If you run the server, nothing is required. If you switched your authenticator to INHERIT to get past “Could not find the table”, you can switch it back:

sql
CREATE ROLE authenticator LOGIN NOINHERIT PASSWORD '...';
GRANT web_anon, web_user TO authenticator;

If you run the Lambda adapter, its paths move to where the server has them: tables under /api, GraphQL at /v1/graphql. Set PGRST_COMPAT_MODE=true to serve the REST surface at the root as well; the old root paths only ever answered unfiltered reads. The pool is two connections per sandbox unless PGRST_DB_POOL_SIZE says otherwise, and the function must not connect as a superuser.

If you depend on the crates, nothing changes; there is only more to call.

Known gaps

On Lambda: no GraphQL subscriptions, since a function cannot hold a WebSocket, and no PGRST_DB_CHANNEL_ENABLED schema reload, since a frozen sandbox cannot listen; a new deployment or a cold start loads the schema afresh. [Superseded in 2.3.0: Cloudflare Workers is now supported via postrust-worker and Hyperdrive — see Cloudflare Workers docs.]

In subscriptions: a connection keeps the identity it was opened with, so a token that expires while a subscription is open does not end it — a client that needs that should reconnect with a fresh token. A live query on a table without a trigger re-reads on PGRST_SUBSCRIPTION_REFRESH (30 seconds by default) rather than when a row changes.

In Federation, unchanged from 2.0.0: the primary key is the only @key, so repeatable keys and nested keys are not expressible, and neither are extended or external fields, @requires, @provides, @override, @tag, @inaccessible, @composeDirective, @interfaceObject or federated tracing. Apollo counts these as optional capabilities; the compatibility fixture keeps them in its target schema on purpose, so they show in every report rather than being dropped from it. The suite’s @shareable check also reported a failure in 2.2.0 because it looked for the directive on the type (Postrust now places @shareable on the shared entity type as well as each non-key field).

In the dialects, unchanged since 1.0: the largest gap is introspection, and it is not reachable from here — async-graphql builds its own registry and keeps it private, so the directives it installs and the order it lists types in cannot be changed from outside the library. Beside it: _stream subscriptions, the cursor-based half of Hasura’s subscription surface; and the OpenAPI document PostgREST serves at /.

In the proxy, also unchanged: no HTTP/3, no upstream HTTP/2 over TLS, no response cache, no retry or circuit-breaking, no configuration reload, and automatic certificates are HTTP-01 only, so no wildcards. The FINDINGS.md files record the rest.

Previous releases

2.1.0

Row-level security sees the same identity over GraphQL as over REST, subscriptions included. The verified JWT claims reach GraphQL transactions, and a WebSocket is authenticated from its connection_init payload as an HTTP request is. Subscriptions over a WebSocket had not worked on the server as shipped; they do. Thanks to @CBeardSafire, #45.

The documented per-claim policies were rewritten to hold on pooled connections, where a setting a connection once held reads as an empty string rather than NULL.

2.0.0

Postrust can be an Apollo Federation v2 subgraph. Opt-in with PGRST_GRAPHQL_FEDERATION=true: _service and _entities, a table’s primary key as its @key, shared entities, a type prefix for composing several Postrust subgraphs, and columns exposed as GraphQL ID. Apollo’s compatibility suite gates the build. Thanks to @CBeardSafire, #42.

A major version for the Rust API only: Federation added public fields to configuration and schema structs, which are now #[non_exhaustive] so the next such feature is a minor release. For the server, the one change to notice was that a malformed boolean setting stopped startup instead of reading as false.

1.0.1

The server could not talk to a hosted database over TLS, and did not say so. sqlx was built without any TLS feature, so sslmode=require failed outright, and the default sslmode=prefer silently fell back to cleartext — every 1.0.0 deployment against a hosted database was unencrypted on the wire unless it had asked for require and noticed the error. Fixed with rustls verifying against the host trust store, so a private CA works without rebuilding, and a test keeps the feature enabled.

rustls moved to 0.23.45 for RUSTSEC-2026-0285, which enabling TLS in sqlx had made reachable from the stable line. Thanks to @CBeardSafire, who found the TLS problem and sent the fix in #38.

1.0.0

Seven crates took a semver promise: a breaking change to the public Rust API needs a major bump, which is why the Federation release was 2.0.0. postrust-proxy and postrust-worker moved to their own 0.x lines, and nothing in the stable line depends on either.

No code changed from the beta. The throughput figures were restored, measured on dedicated bare metal behind a gate that rejects a run the machine drifted under, and both conformance suites were re-run from a clean tree. The work before it made the HTTP proxy runnable and testable — automatic certificates, host routing over HTTP/2, domain verification that proves something, and a declared minimum Rust version of 1.88.

The full history is in CHANGELOG.md.

Try it

bash
docker pull postrust/postrust:3.4.0

Subscriptions are at ws://<host>/v1/graphql/ws, over graphql-transport-ws or the older graphql-ws, with the token in the connection_init payload. The policies that read the claims are in the authentication docs.