Postgresql Upgrade from 9.1.9 to 9.4.5 pg_stat_activity.procpid causes failure

postgresqlupgrade

Attempting to upgrade from 9.1.9 to 9.4.5 Postgresql.

pg_upgrade process fails while trying to pg_restore pg_stat_activity. This fails because the column name differs from the old system to the new system.

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 498; 1259 26457 VIEW blocking_procs postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  column a.procpid does not exist
LINE 14: ...bl" JOIN "pg_stat_activity" "a" ON (("bl"."pid" = "a"."procp...

How does one solve this issue and use pg_upgrade to move from 9.1.9 to 9.4.5?

Best Answer

Apparently, you have a view, blocking_procs on top of pg_stat_activity. You will need to drop that view and reinstall it after the upgrade.

DROP VIEW blocking_procs;
Related Question