Postgresql DB backup fails if using system instance

I am running Ubuntu Bionic LTS (18.04). Since I already have a system-wide instance of postgresql installed, I am reusing that one over running the bundled server. I.e. in my gitlab.rb, I have:

gitlab_rails['db_host'] = "localhost"
gitlab_rails['db_port'] = 5432

However, updating fails with an error about version incompatibility because:

/opt/gitlab/embedded/bin/pg_dump -> 


$ /usr/bin/pg_dump --version
pg_dump (PostgreSQL) 10.3 (Ubuntu 10.3-1)

Hence the whole upgrade process fails. Symlinking /opt/gitlab/embedded/bin/pg_dump to /usr/bin/pg_dump seems to act as a workaround.

It would be nice if gitlab could use pg_dump from the PATH instead than in /opt/gitlab/embedded/bin if its configuration points out we are not using the bundled postgresql instance.