[PATCH] Add regression test for mismatched ENCODING and LOCALE in CREATE DATABASE
Yushu Chen <gentcys@gmail.com>
From: Yushu Chen <gentcys@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2026-05-23T12:10:26Z
Lists: pgsql-hackers
Attachments
- v1-0001-regress-test-create-database-with-locale-encoding.patch (application/octet-stream) patch v1-0001
Hi,
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.
This patch adds a regression test covering incompatible ENCODING and
LOCALE combinations, for example:
CREATE DATABASE dbtest
LOCALE 'en_US.UTF-8'
ENCODING LATIN1
TEMPLATE template0;
Which is expected to fail due to the encoding/locale mismatch.
The patch only adds test coverage and does not change backend behavior.
Regards,
Yushu