Update Ubuntu postgresql instructions
Problem
I just spent several hours trying to fix my postgres related GDK setup on a Pop_OS! 19.10 laptop. For some reason (maybe only recently introduced?) the GDK had started to complain after running gdk update
that I wasn't using postgresql-10 on my machine, which was true; PG must have been upgraded to v11 during the system upgrade from 18.04 to 19.10 since there isn't even a postgres-10 package anymore in the Ubuntu Eoan PPAs AFAICT. I then had multiple versions of postgres installed (11 and 12), but the pg_config
tool reported paths and VERSION
for Postgres 12 only, the latest version.
Long story short, I think I traced the problem down to the initial preparation instructions. They suggest to install the following postgres packages on Ubuntu based distributions:
postgresql postgresql-contrib libpq-dev
This is problematic, because postgresql
is a virtual package or alias, and it will change to always depend on the latest postgres version available:
$ apt show postgresql
Package: postgresql
Version: 12+210.pgdg19.10+1
Priority: optional
Section: database
Source: postgresql-common (210.pgdg19.10+1)
Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
Installed-Size: 67,6 kB
Depends: postgresql-12
The second problem is with the libpq-dev
package. On Ubuntu 19.10, this does not exist for PG-10, only for 11 and 12:
$ apt show -a libpq-dev | grep Version
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Version: 12.1-1.pgdg19.10+1
Version: 11.5-1
Since pg_config
is part of that package, and since the GDK uses pg_config
internally to detect pg library and bin paths, this will ultimately point to PG versions > 10 and sort of break itself.
Solution
I found a solution in doing the following things:
- Use the official PostgreSQL PPAs instead of those that ship with Ubuntu. This will bring back the
postgresql-10
package. - Do not install
libpq-dev
; installpostgresql-server-dev-10
instead, which replaces the former and will install the correctpg_config
tool for PG10.
This solved the problem for me.