How to drop all connections to a specific database in postgres without stopping the server?

Is there a way to fix this problem with my PostgreSQL database/server?

  • I seem to have had PostgreSQL version 9.1 installed on my Mac (maybe it was included automatically). However, after I updated to 9.2.3, i got this error in the logs. I can't figure out from the docs what I should do in this situation from the logs FATAL:  database files are incompatible with server DETAIL:  The data directory was initialized by PostgreSQL version 9.1, which is not compatible with this version 9.2.3. These are the full logs LOG:  database system was shut down at 2012-02-27 19:18:09 PST LOG:  autovacuum launcher started LOG:  database system is ready to accept connections LOG:  received fast shutdown request LOG:  aborting any active transactions LOG:  autovacuum launcher shutting down LOG:  shutting down LOG:  database system is shut down LOG:  database system was shut down at 2012-02-27 21:30:56 PST LOG:  autovacuum launcher started LOG:  database system is ready to accept connections FATAL:  role "shawsome" does not exist FATAL:  role "shawsome" does not exist FATAL:  role "shawsome" does not exist ERROR:  role "myname" already exists STATEMENT:  CREATE ROLE  MYNAME PASSWORD 'md5b42169a737cea337fe663aa9fbb1df19' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN; WARNING:  pgstat wait timeout WARNING:  pgstat wait timeout WARNING:  pgstat wait timeout LOG:  database system was interrupted; last known up at 2012-02-28 21:32:13 PST LOG:  database system was not properly shut down; automatic recovery in progress LOG:  record with zero length at 0/1714388 LOG:  redo is not required LOG:  autovacuum launcher started LOG:  database system is ready to accept connections WARNING:  pgstat wait timeout WARNING:  pgstat wait timeout FATAL:  database files are incompatible with server DETAIL:  The data directory was initialized by PostgreSQL version 9.1, which is not compatible with this version 9.2.3.

  • Answer:

    Use http://www.postgresql.org/docs/9.2/static/pgupgrade.html. Different major releases of PostgreSQL (e.g. 9.1 vs 9.2) are usually binary-incompatible. Major releases of PostgreSQL usually add new features that usually change the layout of the system tables, so PostgreSQL 9.2 might require some system tables which are not present in PostgreSQL 9.1 data directory. pg_upgrade allows data stored in PostgreSQL data files to be upgraded to a later PostgreSQL major version.

Hadi Moshayedi at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.