I'm having problems with a PostgreSQL database instance on Windows. It may be a problem with the database, or it may be a problem with the installation.

I'd like to try re-installing the same version of PostgreSQL.

I have two basic questions....

  1. Without being able to run psql (since the database won't start) how can I determine exactly which version of PostgreSQL I'm running? I'm pretty sure it's nine point something, but would like a definitive answer. Is it written in a config file somewhere?
    SOLVED - see comments below

  2. How do I repair the installation? I know the normal upgrade path is to

    • dump all tables,
    • install new version,
    • import old data back.

This isn't open to me because I can't actually open the database. Will a new installation be able to pick up all the existing data files without problems? The installation package from www.enterprisedb.com doesn't actually come with a repair option (not that I can spot) so I'm concerned that all my configuration information for my database may simply get overwritten.

The first problem I've encountered is that when I'm prompted for a location for my data files it objects to the fact that there are already data files in that location.

I can't believe I'm the only person ever to try a PostgreSQL repair, but I'm having trouble finding any useful links.

Thanks

  • Find the Postgres.exe binary in Windows Explorer & right-click to view the properties - pretty sure the version number will be there – Philᵀᴹ Aug 9 at 17:05
  • @Phil - it does! Version 9.5.7.17129. thank you! – Hemel Aug 9 at 17:08
  • 1
    Before you go any further: make a copy of your Postgres data directory. Then (re)install Postgres 9.5 After that you should stop the Windows service, empty the contents of the live data directory and copy from your backed up data directory. It might work, but there's no guarantee as your data directory's contents may have been damaged. – Colin 't Hart Aug 10 at 19:35
  • @Colin'tHart That should be an answer actually. Could you convert your comment into an answer please? Thanks. – hot2use Aug 13 at 6:40

Before you go any further: make a copy of your Postgres data directory.

Then (re)install Postgres 9.5.

After that you should stop the Windows service, empty the contents of the live data directory and copy from your backed up data directory (don't move from your backup -- starting Postgres against it will probably change the contents). Finally attempt to restart the Windows service.

It might work, but there's no guarantee as your data directory's contents may have been damaged.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.