Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are some steps you can take to troubleshoot the "command not found" error when attempting to upgrade PostgreSQL using pg_upgrade:

  1. Check the location of the pgupgrade binary: The pgupgrade binary should be located in the PostgreSQL bin directory. If it's not, you can add the directory to your PATH variable or use the full path to the binary when running the command.

  2. Check that PostgreSQL 12 is installed: Make sure that you have installed PostgreSQL 12 on your system. You can check this by running the command "psql --version". If PostgreSQL 12 is not installed, you can download it from the official PostgreSQL website and install it.

  3. Check the syntax of the pgupgrade command: Make sure you are using the correct syntax for the pgupgrade command. The command should be of the form:

pgupgrade -b [OLDBINDIR] -B [NEWBINDIR] -d [OLDDATADIR] -D [NEWDATADIR] -o "[OLDOPTIONS]" -O "[NEW_OPTIONS]"

Where [OLDBINDIR] and [NEWBINDIR] are the paths to the bin directories of the old and new PostgreSQL versions, respectively, [OLDDATADIR] and [NEWDATADIR] are the paths to the data directories of the old and new PostgreSQL versions, respectively, and [OLDOPTIONS] and [NEWOPTIONS] are any additional command-line options you want to pass to the old and new PostgreSQL versions, respectively.

  1. Check file permissions: Ensure that you have permission to read and write to the PostgreSQL data directory. The user running the pg_upgrade command should have permission to write to the new data directory.

  2. Check for PostgreSQL running processes: Ensure there are no running PostgreSQL processes or services. You should stop any running PostgreSQL processes before running the pg_upgrade command.

  3. Check for conflicting installations: If you have multiple installations of PostgreSQL on your system, make sure you are using the correct binaries and data directories for the version you want to upgrade.

  4. Check for other errors or warnings: Review the output of the pg_upgrade command carefully for any other errors or warnings. Address any issues before attempting the upgrade again.