1

My default Postgres (installed via brew) is at v14, and I can't start it because the files are at version 12:

DETAIL: The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 14.0.

I can't upgrade the files:

==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postgres...
Error: Failure while executing; `/usr/local/opt/postgresql/bin/initdb --lc-collate=C --lc-ctype=C --lc-messages=C --lc-monetary=C --lc-numeric=C --lc-time=C -E\ UTF8 /usr/local/var/postgres` exited with 1.

There is also this error when I do brew services:

postgresql error /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist

I have version @12 installed but when I open it I can't see the databases in my default install.

What is the best path forward to resolve this?

6
  • 1
    Did you tried doing pgdump_all on the version 12 and later restore to version 14? Commented Oct 15, 2021 at 15:57
  • @JoseCabreraZuniga - no will pgdump_all work even though my default install is not running? Commented Oct 15, 2021 at 15:59
  • 1
    you might need to config your postgres 12 to use the folder where the DB files are located and try again. Out of that... I am out of options. Commented Oct 15, 2021 at 16:12
  • @JoseCabreraZuniga do you know what path I put in on OSX? Do I just put in /usr/local/var/postgres ? Commented Oct 15, 2021 at 16:46
  • 1
    Hope this link can help you: stackoverflow.com/questions/1137060/… Commented Oct 15, 2021 at 16:52

1 Answer 1

1

On your postgres 12 set the folder where the data you need (or a copy of this folder) as the working folder for postgres 12. Do pgdump on this version and then pg_restore on postgres 14.

Use the next link to identify the working folder:

Where does PostgreSQL store the database?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.