0

OS is openSUSE Tumbleweed. Previously I had PostgreSQL 13 installed. I just removed it by:

> sudo zypper rm 'postgres*'

> sudo zypper rr PostgreSQL

> sudo rm -rf /usr/local/var/postgres

Then I install PostgreSQL 12 by instructions here:

> sudo zypper addrepo http://download.opensuse.org/repositories/server:database:postgresql/openSUSE_Tumbleweed/ PostgreSQL

> sudo zypper ref

> sudo zypper in -f postgresql postgresql-server postgresql-contrib

> sudo zypper in -f postgresql-plperl postgresql-plpython postgresql-pltlc

> sudo systemctl enable postgresql

> sudo systemctl start postgresql

But the database status is faulty:

> sudo systemctl status postgresql.service  
[sudo] password for root:  
● postgresql.service - PostgreSQL database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Thu 2021-05-27 23:08:43 EDT; 2h 10min ago
    Process: 1576 ExecStart=/usr/share/postgresql/postgresql-script start (code=exited, status=1/FAILURE)
        CPU: 21ms

May 27 23:08:43 localhost systemd[1]: Starting PostgreSQL database server...
May 27 23:08:43 localhost postgresql-script[1576]:  Your database files were created by PostgreSQL version 13.
May 27 23:08:43 localhost postgresql-script[1576]:  Could not find executables for this version.
May 27 23:08:43 localhost postgresql-script[1576]:  Please install the PostgreSQL server package for version 13.
May 27 23:08:43 localhost systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
May 27 23:08:43 localhost systemd[1]: postgresql.service: Failed with result 'exit-code'.
May 27 23:08:43 localhost systemd[1]: Failed to start PostgreSQL database server.

For some reason, whatever I try, I cannot get rid of these status errors:

Your database files were created by PostgreSQL version 13.

Could not find executables for this version.

Please install the PostgreSQL server package for version 13.

How can I install PostgreSQL 12 and get rid of PostgreSQL 13 database files?

5
  • 2
    Remove the old data directory (that will destroy all data) and run initdb from the v12 installation to create a compatible data directory. May 28, 2021 at 6:04
  • @LaurenzAlbe Right, I'm confused about data directory location.
    – Megidd
    May 28, 2021 at 6:05
  • @LaurenzAlbe I have tried this, but didn't help: sudo rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8
    – Megidd
    May 28, 2021 at 6:07
  • 1
    "Didn't help" is too little information for a meaningful reply. Locate the data directory from the startup file (probably a systemd service file). May 28, 2021 at 6:19
  • @LaurenzAlbe Thanks :) I'm installing a platform that recommends Pg 12, so I decided to downgrade from 13 to 12! I think a better plan is to reinstall Pg 13 and stick with it. I won't come back to 12 unless something goes wrong with 13.
    – Megidd
    May 28, 2021 at 6:47

1 Answer 1

-1

I decided to abandon the idea of downgrading from 13 to 12. I reinstalled Pg 13 and am sticking with it.

I work with a platform that recommends Pg 12. However, I won't come back to 12 unless something goes wrong with 13.

Not the answer you're looking for? Browse other questions tagged or ask your own question.