I just deployed updates to a small fleet of mostly-identical machines and this issue (pg_ scripts enter a recursive loop and consume all available memory) happened on just one of them. Went through the usual remove & purge and reinstall and the issue persisted. Turned out that I had an old Postgres directory in /usr/lib/postgresql (/usr/lib/postgresql/9.4-bak). Once I removed this and reinstalled (removed, purged, installed) all the postgresql packages, no problems! I was then able to recreate the cluster, reload data, everything works normally. Seems something in PgCommon.pm's get_versions function didn't like /usr/lib/postgresql/9.4-bak existing.
Maybe this helps you, Andrej. Regards, Bryce Chidester bryce.chides...@calyptix.com Calyptix Security