When in your distribution the postgres is stick to version 10 and you have to upgrade to postgres-11 a good way to do a capistrano deploy is like this
Do the system install with
yum install postgresql10-contrib postgresql10-devel
And then in your /shared/.bundle/config add a line showing the location of the pg libraries
---
BUNDLE_PATH: "/opt/application/shared/bundle"
BUNDLE_BUILD__PG: "--with-pg-config=/usr/pgsql-10/bin/pg_config"
BUNDLE_FROZEN: "true"
BUNDLE_JOBS: "4"
BUNDLE_WITHOUT: "development:test"
Thanks to my colleague Kris for finding the solution.