With many started postgresql services, psql chooses the lowest postgresql version
I have installed two versions of postgresql, 12
and 13
(in an earlier version of this question, these were 9.1
and 9.2
, I change this to be in line with the added output details from the higher versions).
sudo service postgresql status
12/main (port 5432): down
13/main (port 5433): down
They are located at /etc/postgresql/12/
and /etc/postgresql/13/
.
After installing an extension on version 13
:
sudo apt-get install postgresql-contrib postgresql-plpython3-13
start the postgresql service:
sudo service postgresql start
which outputs:
* Starting PostgreSQL 12 database server
* Starting PostgreSQL 13 database server
Now let us create the extension in the database, running:
sudo su - postgres
and then:
postgres=# psql
psql (13.4 (Ubuntu 13.4-1.pgdg20.04+1), server 12.7 (Ubuntu 12.7-0ubuntu0.20.04.1))
Type "help" for help.
postgres=# CREATE EXTENSION plpython3u;
ERROR: could not open extension control file "/usr/share/postgresql/12/extension/plpython3u.control": No such file or directory
We see that the extension is searched in version 12
although I have installed the postgresql-python3u
to the directory of version 13
.
Aim
I want to use version 13
only, I don't need two different versions, and psql seems to choose the lowest available postgresql version of the started services by default, not the highest which I need.
How to either remove version 12
safely or make 13
the only started (or default) service, also using the standard port 5432
for version 13
?