Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql command pg_update fails going from version 14 to 15

Tags:

postgresql

I run a command that seems like it should work. Both the old bin and new bin dirs contain correct postgres versions. But the command fails as if this is reversed. What? Am? I? doing wrong?

pg_upgrade --old-bindir /usr/local/Cellar/postgresql/14.9/bin/ \
             --new-bindir /usr/local/Cellar/postgresql@15/15.4/bin/ \
             --old-datadir /usr/local/var/postgres.14.9.backup \
             --new-datadir /usr/local/var/postgres \

check for "/usr/local/Cellar/postgresql@15/15.4/bin/postgres" failed: incorrect version: found "postgres (PostgreSQL) 15.4 (Homebrew)", expected "postgres (PostgreSQL) 14.9 (Homebrew)" Failure, exiting

I tried the new pg_upgrade binary and that resulted in

-----------------------------
Checking cluster versions
This utility can only upgrade to PostgreSQL version 15.
Failure, exiting
like image 531
David Lazar Avatar asked Mar 27 '26 22:03

David Lazar


1 Answers

The pg_upgrade binary you call (which is found from your PATH in your example) needs to be the one from the new version, not from the old version.

Either fix your PATH, or give the absolute path to the pg_upgrade executable:

/usr/local/Cellar/postgresql@15/15.4/bin/pg_upgrade ...
like image 187
jjanes Avatar answered Apr 02 '26 20:04

jjanes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!