Migrating from PostgREST
What carries over unchanged, and the few things to check.
If you run PostgREST today, dbrest is meant to be a drop-in for the HTTP
contract. The URL grammar, operators, embedding, Prefer headers, error
envelopes, and OpenAPI root are the same. This page is the short list of what
carries over and what to check.
What carries over unchanged
- The API. Every request your clients make against PostgREST works against
dbrest: projection, the operator set, boolean trees, ordering with NULLS
placement,
limit/offsetandRangepagination, the singular object type, resource embedding,/rpccalls, and content negotiation. - The errors. The four-key envelope and the
PGRSTandSQLSTATEcodes are the same. - The config names. dbrest reads PostgREST option names, and accepts the
PGRST_*environment spelling, so your existing config file and environment are a valid starting point. The nativeDBREST_*spelling exists too and wins when both are set. - Auth. JWT verification, the role claim, the anon role, and the JWT cache behave as in PostgREST v14.
What to set for dbrest
- Pick a backend. Add
db-backendand pointdb-uriat it. On PostgreSQL there is nothing else to learn. - Mind the v14 baseline. The compatibility target is PostgREST v14. If you
are on an older PostgREST, note the v14 changes:
jwt-cache-max-entriesreplaces the oldjwt-cache-max-lifetime,log-queryis a boolean, and the/configadmin endpoint is gone.
What to check when the backend is not PostgreSQL
On PostgreSQL, dbrest is the reference and nearly everything is Native. On the other engines, a few features are Emulated, Best-effort, or Unsupported. Before you switch, check the capability model for:
- Array and range operators (
cs,cd,ov,sl,sr,adj), which are Best-effort or Unsupported away from PostgreSQL. - Regex (
match,imatch), which is Unsupported on SQL Server. - Full text, which is Best-effort on most engines and needs an index, for example an FTS5 index on SQLite.
- NULLS ordering and upsert conflict targets, which reach the same result by a different mechanism and are worth a spot check.
An Unsupported feature returns PGRST127 naming the feature and backend, so you
find the boundary in testing rather than in production.
What the backends still need
On engines without engine-side metadata, you supply it through configuration:
- MongoDB and foreign-key-less SQL schemas need
declared-relationshipsfor embedding, and MongoDB needsdeclared-schemafor types and keys. - SQLite and MongoDB need a
function-registryfor/rpcfunctions. - The emulated backends need a
policy-registryfor privileges and RLS.
A migration checklist
- Stand dbrest up against your existing PostgreSQL with your current config and confirm your test suite passes unchanged.
- If you are moving to another engine, read the capability model and run the conformance harness against that backend.
- Supply the declared registries the target backend needs.
- Re-point your clients. They should not need a change.