Skip to content

Operations

Configure least-privilege roles for scanning vs. publishing dictionaries, plan logical and physical backups, diagnose common errors, and uninstall safely.

For throughput measurements, parallel execution plans, and per-worker cache sizing, see Performance and tuning.

1. Least-privilege permissions

A superuser installs acdat. By default, PUBLIC receives USAGE on the acdat schema and EXECUTE on scanning/compilation functions, while managed catalog tables and publish / activate / retire_build are revoked from PUBLIC.

Separate read-only scanning roles from dictionary administrators:

-- Scan-only role: reads currently active published machines
CREATE ROLE app_scanner;
GRANT SELECT ON acdat.active_machine TO app_scanner;

-- Dictionary admin role: publishes, activates, and retires managed builds
-- (management functions run SECURITY INVOKER, so both table and function grants are required)
CREATE ROLE dict_admin;
GRANT SELECT, INSERT, UPDATE, DELETE ON
    acdat.dictionary,
    acdat.dictionary_version,
    acdat.dictionary_build,
    acdat.dictionary_build_data,
    acdat.active_dictionary
TO dict_admin;

GRANT EXECUTE ON FUNCTION
    acdat.publish(text, bigint, acdat.machine, jsonb),
    acdat.activate(text, bytea),
    acdat.retire_build(text, bytea)
TO dict_admin;

2. Backup, restore, and replication

  • Logical dumps (pg_dump): acdat registers its catalog tables via pg_extension_config_dump(), dumping all dictionary, version, and build metadata, active pointers, and active machine payloads. Inactive historical payloads are excluded to keep dumps compact—back up your application rule tables so inactive versions can be recompiled on demand.
  • Physical backups and PITR: Include all logged active and inactive payloads automatically. Install a compatible acdat shared library on the recovery host before starting PostgreSQL.
  • Logical replication: Install acdat on subscribers beforehand, then either replicate metadata, payload, and activation atomically in one transaction or recompile dictionaries independently on subscribers from replicated source rules.

3. Common errors

Error messageCause and fix
acdat compile failed: pattern ID 1 is duplicatedEvery rule in one dictionary must have a unique pattern_id. Deduplicate or assign distinct IDs.
acdat scan failed: match count exceeds limit 2Raw overlapping hits exceeded max_matches (or max_replacements) before overlap resolution. Prune overlapping rules or raise the measured cap.
acdat pattern ID 1 has no replacementacdat.replace() selected a rule whose replacement was NULL. Supply a literal replacement (or '' to delete).
cannot retire the active acdat buildActivate another ready build first, then retire the previous build.
acdat machine input kind does not match function inputA text machine was passed to a bytea function (or vice versa). Keep machine and input types paired.
acdat build is absent, retired, or has no artifact payloadPublish or recompile the target build before calling acdat.activate().

Other quick checks: cast empty arrays explicitly (ARRAY[]::text[]), note that an aggregate over zero rows returns NULL, and on permission errors verify both table and function grants for SECURITY INVOKER management functions.

4. Uninstall

Warning

DROP EXTENSION acdat removes all managed catalog tables and compiled machines. Adding CASCADE also drops dependent application tables, views, or functions. Back up your source rules and inspect dependencies before removing the extension.