Skip to content

Auto-detect locale from old cluster during upgrade#51

Open
fila43 wants to merge 1 commit intodevexp-db:masterfrom
fila43:master
Open

Auto-detect locale from old cluster during upgrade#51
fila43 wants to merge 1 commit intodevexp-db:masterfrom
fila43:master

Conversation

@fila43
Copy link
Contributor

@fila43 fila43 commented Jan 26, 2026

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

It Needs to be tested

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
Copy link

@pkhartsk pkhartsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else seems fine, I'll write some tests.

Comment on lines +288 to +291
result=$("$old_bindir/psql" -t -A -h "$temp_sockdir" -p "$query_port" -d template1 -c "$query" 2>/dev/null)
psql_exit_code=$?
else
result=$("$old_bindir/psql" -t -A -p "$query_port" -d template1 -c "$query" 2>/dev/null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be just psql without the $old_bindir since it's not actually shipped there and the client works with old server versions

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