pg-upgrade fails to upgrade to postgresql 17
Summary
With the opt-in PostgresQL 17.7, gitlab-ctl pg-upgrade -V 17 will fail:
There was an error fetching locale and encoding information from the database
Please ensure the database is running and functional before running pg-upgrade
STDOUT:
STDERR: ERROR: unrecognized configuration parameter "lc_ctype"
== Fatal error ==
Please check error logs
== Reverting ==
ok: down: postgresql: 1s, normally up
Symlink correct version of binaries: OK
ok: run: postgresql: (pid 3865) 0s
== Reverted ==
== Reverted to 16.11. Please check output for what went wrong ==
Cause analysis
lc_collate and lc_ctype has been removed in PostgreSQL 16.
https://www.postgresql.org/docs/16/release-16.html
Remove read-only server variables lc_collate and lc_ctype (Peter Eisentraut)
pg-upgrade will fail to call get_locale_encoding via SHOW LC_COLLATE and SHOW LC_CTYPE
We should remove the dependent --locale, --lc-collate and --lc-ctype for initdb cli.
Edited by Lucas Li