Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When upgrading from postgres 9.2 to 9.3 by following the upgrade procedure found in PostgreSQL 9.3.4 documentation about pg_upgrade, the following command fails:

RUNAS /USER:postgres "CMD.EXE"

After some investigation, it seems there is no postgres windows user on the machine. This causes the pg_upgrade command to fail as well.

How should I run the upgrade process?

share|improve this question
Just use a regular user but make sure that user can write to both data directories (the new and the old one). – a_horse_with_no_name May 7 '14 at 21:54

Open an administrator cmd window as described in the link above.

Make sure you cd into an empty writable folder (for example, c:\temp\somewhere).

Execute the pg_upgrade command, and make sure to add an -u postgres parameter to it:

"C:\Program Files\PostgreSQL\9.3\bin\pg_upgrade.exe" -u postgres 
    --old-datadir "C:/Program Files/PostgreSQL/9.2/data" 
    --new-datadir "C:/Program Files/PostgreSQL/9.3/data" 
    --old-bindir "C:/Program Files/PostgreSQL/9.2/bin" 
    --new-bindir "C:/Program Files/PostgreSQL/9.3/bin"
share|improve this answer
Use -U (capital "U") for postgres 9.5! – David Murdoch Feb 1 at 17:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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