1

I've recently updated from version 14 to 15 and I can't figure out why it's still using the data directory for 14.

I've verified that I'm using version 15.

$ sudo -u postgres psql -V
psql (PostgreSQL) 15.1 (Ubuntu 15.1-1.pgdg20.04+1)

However the data directory is still version 14.

$ sudo -u postgres psql -c "SHOW data_directory;"
       data_directory        
-----------------------------
 /var/lib/postgresql/14/main
(1 row)

I've verified that the data directory in postgresql.conf is correct.

$ sudo grep data_directory /etc/postgresql/15/main/postgresql.conf
data_directory = '/var/lib/postgresql/15/main'

When I switch to the postgres user and check /var/lib/postgresql/15/main there is no postgresql.conf file.

How can I get postgres to use the correct data directory?

Edit: I've just checked sudo -u postgres psql -c "SHOW config_file;" and it's set to /etc/postgresql/14/main/postgresql.conf so I will dig into that.

2
  • 1
    You have verified that your client version is v15. You haven't verified the server version. Newer client will connect to older server without complaint.
    – jjanes
    Commented Apr 19, 2023 at 13:00
  • 1
    Under ubuntu by default, the config file is not stored in the data directory. Of course '/var/lib/postgresql/15/main/postgresql.conf' doesn't (or shouldn't) exist, because you just demonstrated that it is called '/etc/postgresql/15/main/postgresql.conf' instead.
    – jjanes
    Commented Apr 19, 2023 at 13:03

0

Browse other questions tagged or ask your own question.