Error in updating Gitlab-CE from 11.11.3 to 12.0.0 on CentOS 7.6

The "undefined symbol: PQsetErrorContextVisibility" error occured in updating gitlab-ce from v11.11.3 to v12.0.0 on CentOS 7.6 :

Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 
*failure*

Consult the last few lines of "pg_upgrade_utility.log" for
the probable cause of the failure.
Failure, exiting
STDERR: 
Upgrading the data: NOT OK
== Fatal error ==
Error upgrading the database
== Reverting ==
ok: down: postgresql: 27s, normally up
Symlink correct version of binaries: OK
ok: run: postgresql: (pid 45507) 1s
== Reverted ==
== Reverted to 9.6.11. Please check output for what went wrong ==

The last few lines of the "pg_upgrade_utility.log":

command: "/opt/gitlab/embedded/bin/psql" --echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1 --host /var/opt/gitlab/postgresql --port 50432 --username gitlab-psql -f "pg_upgrade_dump_globals.sql" >> "pg_upgrade_utility.log" 2>&1
/opt/gitlab/embedded/bin/psql: symbol lookup error: /opt/gitlab/embedded/bin/psql: undefined symbol: PQsetErrorContextVisibility

More info:

$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
$ sudo yum update gitlab-ce
...

Running handlers:
Running handlers complete
Chef Client finished, 48/734 resources updated in 02 minutes 47 seconds
gitlab Reconfigured!
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 10.7
Checking if we already upgraded: NOT OK
Checking if PostgreSQL bin files are symlinked to the expected location: OK
Toggling deploy page:cp /opt/gitlab/embedded/service/gitlab-rails/public/deploy.html /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling deploy page: OK
Toggling services:ok: down: alertmanager: 183s, normally up
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: grafana: 0s, normally up
ok: down: logrotate: 183s, normally up
ok: down: node-exporter: 182s, normally up
ok: down: postgres-exporter: 182s, normally up
ok: down: prometheus: 181s, normally up
ok: down: redis-exporter: 181s, normally up
ok: down: sidekiq: 178s, normally up
Toggling services: OK
Stopping the database:ok: down: postgresql: 0s, normally up
Stopping the database: OK
Symlink correct version of binaries: OK
Creating temporary data directory: OK
Initializing the new database: OK
Upgrading the data:Error upgrading the data to version 10.7
STDOUT: Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for invalid "unknown" user columns                 ok
Creating dump of global objects                             ok
Creating dump of database schemas
  gitlabhq_production
  postgres
  template1
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 
*failure*

Consult the last few lines of "pg_upgrade_utility.log" for
the probable cause of the failure.
Failure, exiting
STDERR: 
Upgrading the data: NOT OK
== Fatal error ==
Error upgrading the database
== Reverting ==
ok: down: postgresql: 27s, normally up
Symlink correct version of binaries: OK
ok: run: postgresql: (pid 45507) 1s
== Reverted ==
== Reverted to 9.6.11. Please check output for what went wrong ==
Toggling deploy page:rm -f /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling deploy page: OK
Toggling services:ok: run: alertmanager: (pid 45519) 0s
ok: run: gitaly: (pid 45527) 1s
ok: run: gitlab-monitor: (pid 45554) 0s
ok: run: grafana: (pid 45557) 0s
ok: run: logrotate: (pid 45587) 1s
ok: run: node-exporter: (pid 45605) 0s
ok: run: postgres-exporter: (pid 45615) 1s
ok: run: prometheus: (pid 45623) 0s
ok: run: redis-exporter: (pid 45626) 1s
ok: run: sidekiq: (pid 45633) 0s
Toggling services: OK
Ensuring PostgreSQL is updated: NOT OK
Error ensuring PostgreSQL is updated. Please check the logs
warning: %posttrans(gitlab-ce-12.0.0-ce.0.el7.x86_64) scriptlet failed, exit status 1
Non-fatal POSTTRANS scriptlet failure in rpm package gitlab-ce-12.0.0-ce.0.el7.x86_64
  Verifying  : gitlab-ce-12.0.0-ce.0.el7.x86_64                                                                                1/2 
  Verifying  : gitlab-ce-11.11.3-ce.0.el7.x86_64                                                                               2/2 

Updated:
  gitlab-ce.x86_64 0:12.0.0-ce.0.el7                                                                                               

Complete!
Edited by 平民·寻梦(Pingmin F. Liu)