0

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

4
  • Find the Postgres.exe binary in Windows Explorer & right-click to view the properties - pretty sure the version number will be there
    – Philᵀᴹ
    Commented Aug 9, 2018 at 17:05
  • @Phil - it does! Version 9.5.7.17129. thank you! Commented Aug 9, 2018 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. Commented Aug 10, 2018 at 19:35
  • @Colin'tHart That should be an answer actually. Could you convert your comment into an answer please? Thanks.
    – John K. N.
    Commented Aug 13, 2018 at 6:40

1 Answer 1

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 (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

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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