Database upgrade of postgresql from v12 to v13

The postgresql was installed using conda via conda-forge. When running conda upgrade --all, the postgresql was unintentionally updated to v13, and incompatibility of the database happened. The database was originally created manually at v12 so that it works as a user's permission. As a choice, I could downgrade to v12, and it worked. But I tried upgrading to make it work for v13. How to upgrade is shown by

% pg_upgrade --help

Following this, the steps I made for the upgrade are as follow:

  • Step1: mv db_dir db_dir_old
  • Step2: mkdir db_dir
  • Step3: initdb -D db_dir
  • Step4: pg_upgrade -d db_dir_old -D db_dir -b ~/.miniconda/envs/someenv/bin -B ~/.miniconda/envs/someenv/bin