Re: [PATCH] Add regression test for mismatched ENCODING and LOCALE in CREATE DATABASE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yushu Chen <gentcys(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add regression test for mismatched ENCODING and LOCALE in CREATE DATABASE
Date: 2026-05-25 18:42:53
Message-ID: 135169.1779734573@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yushu Chen <gentcys(at)gmail(dot)com> writes:
> While reading the CREATE DATABASE documentation at
> https://www.postgresql.org/docs/current/sql-createdatabase.html, I
> noticed the following sentence:
> "The specified locale and encoding settings must match, or an error
> will be reported."
> However, we do not currently have regression coverage for that failure case.

The reason there is no test for that is that the spelling of locale
names, and indeed the presence of any particular locale, is variable
across platforms. Your proposed test case might work fine on your
machine, but it will fail on a nontrivial fraction of our buildfarm
(where "fail" means "produce some other error message than what the
test is expecting").

As a recent example where I too was overoptimistic about this,
see the sad history of my attempts to install coverage of NLS
translation (8c498479d, 5b275a6e1, fe7ede45f, 7db6809ce,
84a3778c7, 462e24765).

We could perhaps install the test with multiple variant files to
accept the cases we see in practice. But that would be a pain
in the rear for maintenance, and you have to wonder what it'd
actually be proving.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Fittl 2026-05-25 18:43:43 Re: RFC: Allow EXPLAIN to Output Page Fault Information
Previous Message Alexander Korotkov 2026-05-25 17:41:02 Re: Fix SPLIT PARTITION bound-overlap bug and other improvements