chris navarroza <canavarroza.work@gmail.com> writes:
> bash-4.4$ /usr/pgsql-14/bin/pg_upgrade
> --old-datadir=/home/dmartuser/pgdata/data/
> --new-datadir=/home/dmartuser/pgdata/data/ --old-bindir=/usr/pgsql-12/bin/
> --new-bindir=/usr/pgsql-14/bin/ --check --verbose
> Running in verbose mode
> Performing Consistency Checks
> -----------------------------
> Checking cluster versions
> This utility can only upgrade to PostgreSQL version 14.
You cannot use the same directory as --old-datadir and --new-datadir.
I think pg_upgrade is unhappy because what it sees in PG_VERSION in
the --new-datadir isn't v14 ... but I wonder if we shouldn't be
checking for this mistake more directly.
Anyway, the right way to proceed is to use v14's initdb to create
a new directory at, say, /home/dmartuser/pgdata/data-14
and then pg_upgrade to that. Afterwards you can rename the old
data directory out of the way and move the new one to
/home/dmartuser/pgdata/data, if you like.
regards, tom lane