Re: [PATCH] Add regression test for mismatched ENCODING and LOCALE in CREATE DATABASE
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yushu Chen <gentcys@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2026-05-25T18:42:53Z
Lists: pgsql-hackers
Yushu Chen <gentcys@gmail.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