Operations
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:
2. Backup, restore, and replication
- Logical dumps (
pg_dump):acdatregisters its catalog tables viapg_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
acdatshared library on the recovery host before starting PostgreSQL. - Logical replication: Install
acdaton 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 message | Cause and fix |
|---|---|
acdat compile failed: pattern ID 1 is duplicated | Every rule in one dictionary must have a unique pattern_id. Deduplicate or assign distinct IDs. |
acdat scan failed: match count exceeds limit 2 | Raw 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 replacement | acdat.replace() selected a rule whose replacement was NULL. Supply a literal replacement (or '' to delete). |
cannot retire the active acdat build | Activate another ready build first, then retire the previous build. |
acdat machine input kind does not match function input | A 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 payload | Publish 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
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.