It's been some months since I've last used PostgreSQL on my Arch Linux desktop, and, apparently, after some updates, something must have broken. If I ask for the service's status, I get (systemctl status postgresql):
× postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Wed 2024-02-21 16:00:22 -03; 1h 28min ago
CPU: 54ms
fev 21 16:00:22 phili systemd[1]: Starting PostgreSQL database server...
fev 21 16:00:22 phili postgres[11667]: An old version of the database format was found.
fev 21 16:00:22 phili postgres[11667]: See https://wiki.archlinux.org/index.php/PostgreSQL#>
fev 21 16:00:22 phili systemd[1]: postgresql.service: Control process exited, code=exited, >
fev 21 16:00:22 phili systemd[1]: postgresql.service: Failed with result 'exit-code'.
fev 21 16:00:22 phili systemd[1]: Failed to start PostgreSQL database server.
I've already tried to reinstall in various ways. But mostly with something like this:
pacman -Rsn postgresql
rm -rf /var/lib/postgres
pacman -Syu postgresql
The version I'm installing is the latest one, 16, but I've already tried all this with 14 as well. And, yes, I have tried restarting my PC several times.
An old version of the database format was foundand provides a linkSee https://wiki.archlinux.org/index.php/PostgreSQL#. You should read that link to make sure you update your database to the correct version for your installed version of PostgreSQL. Make sure you have a backup of your database first before trying to make changes.pg_upgrade