0.2.0 (2026-11-18)
PostgREST v14 compatibility pipeline. Read docs/guides/upgrading-0.1-to-0.2.md before upgrading:
the defaults for column exposure changed.
Breaking changes
- The default
changeset/3casts every writable field (0.1 cast nothing) and every non-redacted field is readable, filterable and orderable. Setreadable:/writable:or mark secretsredact: true. - A custom
changeset/3decides what is written: only its final changes (keys inchangeset.changes, includingput_change/3) are written, once per row. A value equal to the struct default is not a change unless you cast withforce_changes: true(the default changeset does); acast_embed/3clear to an equal default is omitted. Changes the callback generates for persisted fields are written regardless ofwritable:/redact: true, which gate only keys the client supplies. - Removed the
/:resource/:idroutes. Use/<table>?id=eq.<id>. - Removed the
?not.col=negation form. Use?col=not.<op>.<value>. - Error bodies are PostgREST-shaped (
code,message,details,hint), not{"error": ...}. after_load/2takes and returns a string-keyed map (it was an Ecto struct), runs children first and needsuse PgRest.Resource, after_load: true.- Custom query parameters must be declared with
custom_params: ["search"]; undeclared keys are treated as column filters (an unknown column is a 400). scope/2is a predicate contract:where,joinanddistinctonly.PgRest.Resourceno longer makesscope/2orchangeset/3defoverridable; callingsuperin them does not compile.PgRest.Parser,PgRest.TypeCaster,PgRest.Filter,PgRest.Order,PgRest.Select,PgRest.QueryPipelineandPgRest.Utilsare removed (reads are one SQL statement built from an AST).PATCHandDELETEwithout a filter fail with 40021000unless the plug setsrequire_filters_for_mutations: false.Prefer: tx=rollbackis ignored unless the plug setstx_end: :commit_allow_override.- Telemetry events moved to the
[:pgrest, ...]prefix. allow:is enforced on every resource a request touches, like a missing Postgres grant (42501): a resource without:readcannot be embedded, spread or used as a junction, and its writes cannot read rows back (filters,return=representation, counts,Location).- A request for a resource whose
allow:excludes the operation parses the query string (filter and order grammar) before it is denied, as PostgREST does:?id=foo.1is a400PGRST100, not a401. A denied request still reads a bounded request body (at mostmax_body_bytes). return=headers-onlyis a42501when a primary key column is outsidereadable:.- Declared custom params on
PATCH/DELETEneed:read(they narrow rows like a filter), but only column filters satisfyrequire_filters_for_mutations, and the write check applies the resource scope only, never custom params. - Writes, catalog lookups and the request
search_pathuse the scope's effective schema prefix (put_query_prefix/2inscope/2), as reads do. A per-call Repoprefix:is not supported. - Removed the
:jsonplug option; bodies are encoded and decoded withJason. PgRest.Registrypublishes an immutable snapshot keyed by{schema, table}. It accepts:name(defaultPgRest.Registry; several registries run side by side, andPgRest.Plugpicks one withregistry:),:otp_app,:modulesand:schemas. Resources spanning several schemas need:schemas, and two resources for the sameschema.tableraise. Its ETS tables are gone: the shared caches belong toPgRest.Cache, started by the:pgrestapplication.get_resource/1,list_resources/0andgraph/0read the default registry.- A request whose registry is not running is a 503
PGRST002, not a 500. - Authorization modules receive
:execute/:explainand%PgRest.Function{}targets (module: nilfor introspected functions); handle these or deny via a catch-all. Missing callbacks deny; table operations may useauthorize_query/5alone, but function execution needsauthorize/4. A bare query grant does not grant EXPLAIN. - The plug overrides builder keys including
graph,authenticated?, repo and planner options; RLS also overridesjwt_claimsanddb_role. - Permission errors (
42501) return 401 for anonymous requests and 403 otherwise. - RPC
result_scope: :noneskips row matching only; result query-hook denials, columns, count/aggregate grants and permission limits still apply.
Added
PgRest.Functiondeclarations and filtered function introspection; RPC overloads, typed arguments, scoped result rows and EXECUTE authorization.- Scoped RPC result rows (
result_scope: :stored_rows) keep the function's own output order when the request has noorder: the call runsWITH ORDINALITYand the read sorts by it, solimit/offsetpages follow the function's order. An explicitorderwins, and the number never appears in the response. Unscoped calls keep PostgREST's statement. A scoped row type with a column namedordinalityneedsresult_scope: :none. - Application query policies, per-parent permission limits, JWT/RLS role switching and fail-closed callback rules. RLS requires an explicit role allowlist.
- Aggregates, CSV and null-stripped JSON, execution plans, PUT, OPTIONS, strict preferences, max-affected, timezone and transaction-local response GUCs.
- Custom PT SQLSTATE statuses and JSON PGRST errors with response headers.
- NimbleParsec grammar for select, filters (logic trees,
not,any/all, JSON paths, casts), and order (including related order). - Resource embedding: m2o, o2m, o2o, m2m, self references, hints,
!inner/!left, spreads, aliases, embedded filters, order, limit and offset, empty embeds. - Writes: bulk insert,
columns=,missing=default, upsert (merge-duplicates,ignore-duplicates,on_conflict),return=modes,Location, counts, singular responses,Prefer: tx=, scoped writes with a write check. Rangeheader andlimit/offsethandling,count=exact|planned|estimated,HEAD,Content-Range,Content-Location,Preference-Applied.- Schema profiles:
Accept-Profile(reads) andContent-Profile(writes) pick one of the registry's:schemas(406PGRST106otherwise), and responses carryContent-Profilewhen the schema was negotiated. Embeds stay within the request's schema, as in PostgREST. PgRest.Catalog.facts/1: the server's timezone names, version and whether the login role bypasses RLS, read once per repo.- Plug options:
require_filters_for_mutations,max_limit(every embed too),max_embed_depth,max_body_bytes,max_bulk_rows,count_modes,tx_end,statement_cache,statement_timeout,authorization,aggregates,plan_enabled,rls,anonymous?. - Resource options:
readable:,writable:,relationships:,unique_key:,custom_params:. PgRest.BodyReaderkeeps the raw JSON body for the fast write path.PgRest.Catalogreads column types and defaults of registered tables only.- Differential test harness against a pinned PostgREST (
docker compose, test harness only). PgRest.Ecto.Filter: compiles filter and logic-tree AST nodes intoEcto.Query.dynamic/2expressions (to_dynamic/2) orwhereclauses (where/3) for your own Ecto queries. Fields resolve againstschema:/fields:allowlists (42703otherwise), values cast with the Ecto field type (22P02on failure;:binary_idand{:array, :binary_id}values must be valid UUIDs, normalised to lowercase), and JSON paths,any/alland range operators are refused withPGRST100, as is a hand-built node whose value has the wrong shape for its operator (anisvalue other thannull,not_null,true,falseorunknown, aninvalue that is not a list,nilwith a comparison operator); it never raises on a malformed node. It replaces 0.1'sPgRest.Filter.apply_all/2andPgRest.TypeCaster.cast_filters/2. Seedocs/guides/ecto-filter.md.PgRest.Grammar.Filter.parse_array_literal/1splits a PostgreSQL array literal.PgRest.Grammar.Filter.operator_prefix?/1tells a malformed filter (is.maybe) from a value that is not a filter at all (hello).PgRest.Error.invalid_input/2(22P02) for a value the column type rejects.
Telemetry
[:pgrest, :request]span per request.[:pgrest, :query]span per statement (metadatasql,params_count,prepared, and on stoprowsanderror_kind). It replaces the repo query log, which PgRest turns off withlog: false.[:pgrest, :scope_cache]for the compiled scope SQL cache.- Any raised
PgRest.Erroris classifiederror_kind: :database; stop metadata carrieserror_kind(nil,:database,:connection,:internal).
Known differences from PostgREST
See Compatibility.