1

I'm attempting to upgrade a Postgres instance from version 12 to version 13, following the steps outlined at https://www.postgresql.org/docs/13/pgupgrade.html.

From an elevated command prompt, I'm running (under Windows 10):

SET PATH=%PATH%;C:\Program Files\PostgreSQL\13\bin;

pg_upgrade.exe --old-datadir "E:\Programs\PostgreSQL\12\data" --new-datadir "E:\Programs\PostgreSQL\13\data" --old-bindir "C:\Program Files\PostgreSQL\12\bin" --new-bindir "C:\Program Files\PostgreSQL\13\bin" --old-port=5431 --new-port=5432 --jobs=5

The directories appear to be all correct, however the command returns:

Performing Consistency Checks  
-----------------------------  
Checking cluster versions                                   ok  
  
*failure*  
Consult the last few lines of "pg_upgrade_server_start.log" or "pg_upgrade_server.log" for  
the probable cause of the failure.  
  
connection to database failed: could not connect to server: Connection refused (0x0000274D/10061)  
        Is the server running on host "localhost" (::1) and accepting  
        TCP/IP connections on port 5431?  
could not connect to server: Connection refused (0x0000274D/10061)  
        Is the server running on host "localhost" (127.0.0.1) and accepting  
        TCP/IP connections on port 5431?  
  
could not connect to source postmaster started with the command:  
"C:/Program Files/PostgreSQL/12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "E:/Programs/PostgreSQL/12/data" -o "-p 5431 -b " start  
Failure, exiting  

pg_upgrade_server_start.log says:

command: "C:/Program Files/PostgreSQL/12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "E:/Programs/PostgreSQL/12/data" -o "-p 5431 -b " start >> "pg_upgrade_server_start.log" 2>&1
The program "postgres" was found by "C:/Program Files/PostgreSQL/12/bin/pg_ctl"
but was not the same version as pg_ctl.
Check your installation.

I'm at a loss; what might be wrong, and how can I successfully perform this procedure?

1

The answer had to do with the option "Beta: Use Unicode UTF-8 for worldwide language support" being checked in my locale settings in Windows.

I disabled that option and restarted the computer, the upgrade went without issues after that.

2
  • 1
    It seems incredible that there could be a connection (but noting is impossible on Windows). I would have suspected the PATH setting: don't set PATH, but call pg_upgrade with its absolute path. – Laurenz Albe Mar 11 at 3:57
  • @LaurenzAlbe Indeed. I first suspected locales; then had a hunch, since when installing v12 quite a while back I had to disable that same setting. (Also, I tried not setting PATH as well, with the same results). – Marc.2377 Mar 11 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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