postgresai CLI This Week: RDS Bloat Stats, Tighter Permissions and New Reporter Facts

postgres-ai/postgresai is a Postgres monitoring and health check toolkit with a CLI, an MCP server and a reporter. Nine commits landed in the last week, and the headline is a fix that makes bloat stats work again on current RDS minor versions, plus a permissions cleanup around pg_statistic_rows().

Bloat stats on current RDS minors

The pg_statistic fallback fix (#525) deals with managed Postgres restrictions. On recent RDS minors the postgres_ai.pg_statistic view could not read what it needed, so bloat estimates broke. The view now falls back to pg_stats when the direct path is not available.

A side effect: the view reads pg_statistic_rows() as the calling role. The init verification code now checks for EXECUTE on that function too. You can see the new check in cli/lib/init.ts, and a matching one for Supabase in cli/lib/supabase.ts.

If the function does not exist (older installs), the check passes. So existing setups will not suddenly report a missing privilege.

Grants on pg_statistic_rows() only for monitoring roles

The follow up (#526) closes a gap. Default privileges in a database can hand EXECUTE on a new function to roles you never meant to include. The SQL in cli/sql/03.permissions.sql now revokes every grant except the owner’s, then grants EXECUTE only to the monitoring role.

The same commit adds a verify step, and unprepare-db now works on databases prepared by the platform. The matching cleanup lives in cli/sql/uninit/02.permissions.sql.

Why care: pg_statistic holds sampled column values. Limiting who can call the function that exposes them is the right default.

Issues CLI and MCP tweaks

Small but useful changes in the issues commands:

postgresai issues update <id> --notify

The MCP side is in cli/lib/mcp-server.ts. Check the CLI help for the exact argument shape before scripting it.

Reporter: K004, K005 and sizing facts

The Python reporter in reporter/postgres_reports.py got three additions:

Taken together, the reports carry more raw facts for a reviewer, not just a verdict. Temp file spills and WAL volume are the kind of numbers you want when tuning work_mem or checkpoints.

There is also a fix for table_describe that stops PG18 NOT NULL constraints from being listed twice. PG18 exposes them as constraints, so the output duplicated them.

What to watch

  • If you run the CLI against RDS, upgrade and re run the init verification. It should now report EXECUTE on pg_statistic_rows() as a required privilege.
  • If you rely on default privileges for extra roles, expect them to lose access to that function. That is intended.
  • Track cli/CHANGELOG.md for the release that bundles these changes. I did not see a tagged release in this window.

← All updates