Maintenance or migrations are failing
Maintenance changes delivery and retention state; migrations change schema state. Diagnose them separately. A clean migration status does not prove that scheduled jobs are running, and successful cleanup does not establish schema compatibility.
Maintenance does not run
Check the scheduler's database target, credentials, last successful run, first error, and whether jobs overlap or time out. Installation does not create a scheduler. Run the job manually under its actual role:
psql "$MAINTENANCE_DATABASE_URL" -X -v ON_ERROR_STOP=1 -c 'SELECT * FROM postgremq.pmq_maintenance_fast();' -c 'SELECT postgremq.cleanup_completed_messages(24, 1000);'
A permission error requires the caller's table and function rights, not just permission to connect. A zero return count can be healthy. Compare it with queue state and the retention cutoff before concluding the job failed.
Work remains despite successful jobs
| Observation | Explanation or next check |
|---|---|
| Exhausted deliveries persist | Confirm their visibility deadline has passed and fast maintenance runs in this database. |
| Expired Exclusive queue persists | Inspect its DLQ entries, which can block physical deletion. |
| Completed rows remain | Check completion age, batch limits, locked rows, and cleanup rate. |
| Payloads remain after acknowledgement | Another queue or DLQ entry may still reference them; payload age also matters. |
| Files do not shrink after cleanup | Row deletion and physical file shrinking are different PostgreSQL operations. Inspect reuse and vacuum health. |
Retention is not a TTL for pending work. Do not replace unsuccessful cleanup with a global purge; that changes the task from retaining history to deleting active messages.
Installation or migration fails
Start with the selected CLI release and the intended installer connection:
postgremq status --dsn "$DATABASE_URL"
Inspect current version, latest embedded version, and dirty state. Status can exit zero while migrations are pending or the database is dirty. Preserve the error from migrate, not just the later status output.
For a tracked installation, an authorized owner can inspect:
SELECT version, dirty FROM postgremq.postgremq_migrations;
SELECT postgremq.info();
If the version table does not exist, its absence may be expected before installation. Do not create fabricated tracking metadata to make startup checks pass.
Recover according to the failed state
| State | Response |
|---|---|
| Authentication or connection failure | Repair credentials, TLS, endpoint, or networking; verify the intended database before retrying. |
| Permission or ownership failure | Use the installation owner and inspect existing object ownership. |
| Migration waiting behind another runner | Identify the legitimate migration operation and database lock wait; avoid launching more runners. |
| Dirty migration state | First confirm that no migrator is still running; status reads without the migration lock. Preserve logs and inspect actual schema changes against the failed migration. Rehearse repair or restore before changing production. |
| CLI embeds older migrations than the database | Select the intended tool release; an older tool leaving newer state unchanged is not a downgrade. |
| Full schema script refused an existing install | Use migrations rather than the fresh-install script. |
Do not clear dirty or edit version simply to unblock the command. Those fields describe whether the schema can be trusted to match a release. A repair must establish actual object state first, with release-specific instructions or a verified restore.
After recovery, check status and discovery, test publication and acknowledgement with runtime credentials, and verify scheduled maintenance. Follow Upgrading for the rollout and Backup and recovery for restoration.