Skip to content

v1.17.0 — trusted install, get-else/missing? everywhere, predicates on computed values

Choose a tag to compare

@github-actions github-actions released this 19 Oct 19:21
· 331 commits to master since this release
v1.17.0
24f4153

mentat 1.17.0: install without superuser, get-else and missing? everywhere, predicates on computed values

New

  • pg_mentat installs without superuser
    (#331). The database
    owner, or any role with CREATE on the database, can now run
    CREATE EXTENSION pg_mentat:

    -- as postgres
    CREATE ROLE app LOGIN;
    CREATE DATABASE appdb OWNER app;
    -- as app
    CREATE EXTENSION pg_mentat;
    GRANT USAGE ON SCHEMA mentat TO reporting;              -- app can grant access onward
    GRANT SELECT ON ALL TABLES IN SCHEMA mentat TO reporting;

    The role that installs pg_mentat gets access to it and can grant access to
    others. No other role gets anything (no grants to PUBLIC). Turning on
    row-level security and mentat_tune_indexes(false) still need a superuser.
    To restore a dump of a non-superuser's database, run the restore as that
    role. Details:
    multi-tenancy.md.
    Before this release, a non-superuser couldn't install pg_mentat at all
    (permission denied for language c). Even after a superuser installed it,
    no other role could use it.

  • get-else and missing? on the embedded SQLite store and the DuckDB
    extension
    (#335).
    These were "unknown function" errors before. They now behave as on
    PostgreSQL and in Datomic: any number of patterns, a predicate on the
    result, and an error on cardinality-many attributes.

  • Predicates on computed values (pg_mentat,
    #334). You can now
    filter on a value computed earlier in the query:

    [:find ?v :where [?c :t/value ?v]
                     [(get-else $ ?c :t/rank 0) ?r] [(> ?r 1)]]
    [:find ?s :where [?e :q/n ?n] [?e :q/s ?s] [(* ?n 2) ?d] [(> ?d 4)]]

Fixed

  • +, - and / parse in queries. [(+ ?a 1) ?b] used to be a parse
    error.
  • pg_mentat create_store() no longer fails with
    syntax error at or near "CASE".

Upgrading (PostgreSQL)

Install the files for your PostgreSQL major (pg_mentat-pg15 …
pg_mentat-pg19), then run ALTER EXTENSION pg_mentat UPDATE;. The upgrade
changes no tables or data; it only adds the installing role's grants. We
tested it on Debian 12 with PostgreSQL 15–19, upgrading an existing 1.16.1
database in place.

Known issue

  • You can't write to a store created by create_store(). Transactions
    fail with relation "mentat_<name>.current_instant" does not exist. This
    has been broken since 1.5.0. Until it's fixed, use stores keyed by
    store_id as described in multi-tenancy.md. Fixing it needs a design
    decision
    (#337).

Full details: CHANGELOG.