Skip to content

Comments

auto-detect locale from old cluster during upgrade#52

Open
pkhartsk wants to merge 2 commits intodevexp-db:masterfrom
pkhartsk:master
Open

auto-detect locale from old cluster during upgrade#52
pkhartsk wants to merge 2 commits intodevexp-db:masterfrom
pkhartsk:master

Conversation

@pkhartsk
Copy link

including tests

Automatically detect and preserve locale settings (lc_collate, lc_ctype)
from the old PostgreSQL cluster during upgrade operations. This fixes
upgrade failures when system locale has changed between initialization
and upgrade.

The implementation queries locale from the old cluster's template1
database, temporarily starting the server if needed. Detected locale
values are automatically passed to initdb via PGSETUP_INITDB_OPTIONS.

Fixes: Bug 1152556
@pkhartsk pkhartsk force-pushed the master branch 7 times, most recently from 268116e to 5c19c23 Compare February 23, 2026 15:54
Replaced check for running postgres with failure in `detect_old_locale`,
since the script would fail later anyway, so there's no reason to have
extra code that does nothing.
Fixed `psql` being run from the old pg bin directory.
Wrote a test for the script.
@pkhartsk pkhartsk changed the title [DRAFT] auto-detect locale from old cluster during upgrade auto-detect locale from old cluster during upgrade Feb 23, 2026
@pkhartsk pkhartsk marked this pull request as ready for review February 23, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants