I am running Ubuntu 18.04. When I want to install the PostgreSQL database server package I get the default version 12.
I have unsuccessfully tried to follow multiple instructions on how to install the desired version 9.6.
# cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
# sudo apt-get install postgresql-9.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
postgresql-contrib-9.6
Suggested packages:
libdbd-pg-perl
The following NEW packages will be installed:
postgresql-9.6 postgresql-contrib-9.6
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/4,827 kB of archives.
After this operation, 23.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package postgresql-9.6.
(Reading database ... 70763 files and directories currently installed.)
Preparing to unpack .../postgresql-9.6_9.6.17-2.pgdg18.04+1_amd64.deb ...
Unpacking postgresql-9.6 (9.6.17-2.pgdg18.04+1) ...
Selecting previously unselected package postgresql-contrib-9.6.
Preparing to unpack .../postgresql-contrib-9.6_9.6.17-2.pgdg18.04+1_amd64.deb ...
Unpacking postgresql-contrib-9.6 (9.6.17-2.pgdg18.04+1) ...
Setting up postgresql-9.6 (9.6.17-2.pgdg18.04+1) ...
Setting up postgresql-contrib-9.6 (9.6.17-2.pgdg18.04+1) ...
Processing triggers for postgresql-common (213.pgdg18.04+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
# service postgresql start
# su postgres
postgres@ubuntu-vm-template:~$ psql
psql (12.2 (Ubuntu 12.2-2.pgdg18.04+1))
Type "help" for help.
postgres=# SELECT version();
version
-----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 12.2 (Ubuntu 12.2-2.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0, 64-bit
(1 row)
root@ubuntu-vm-template:~# dpkg -l|grep -i postgres
ii libpq-dev 12.2-2.pgdg18.04+1 amd64 header files for libpq5 (PostgreSQL library)
ii libpq5:amd64 12.2-2.pgdg18.04+1 amd64 PostgreSQL C client library
ii pgdg-keyring 2018.2 all keyring for apt.postgresql.org
ii postgresql-12 12.2-2.pgdg18.04+1 amd64 object-relational SQL database, version 12 server
ii postgresql-9.6 9.6.17-2.pgdg18.04+1 amd64 object-relational SQL database, version 9.6 server
ii postgresql-client-12 12.2-2.pgdg18.04+1 amd64 front-end programs for PostgreSQL 12
ii postgresql-client-9.6 9.6.17-2.pgdg18.04+1 amd64 front-end programs for PostgreSQL 9.6
ii postgresql-client-common 213.pgdg18.04+1 all manager for multiple PostgreSQL client versions
ii postgresql-common 213.pgdg18.04+1 all PostgreSQL database-cluster manager
ii postgresql-contrib 12+213.pgdg18.04+1 all additional facilities for PostgreSQL (supported version)
ii postgresql-contrib-9.6 9.6.17-2.pgdg18.04+1 amd64 additional facilities for PostgreSQL
My Question
The output of apt-get install says "9.6".
Why doesn't the output of SELECT version();
do so?