Dica rápida: Fechando todas as conexões do Postgres
Para o PostgreSQL 9.1 ou inferior:SELECT pg_terminate_backend(pg_stat_activity.procpid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'NOME_DO_BANCO' AND procpid <> pg_backend_pid();
PostgreSQL 9.2 ou superior:
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'NOME_DO_BANCO' AND pid <> pg_backend_pid();