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

From: Yushu Chen <gentcys(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Add regression test for mismatched ENCODING and LOCALE in CREATE DATABASE
Date: 2026-05-23 12:10:26
Message-ID: CAP5x3pYD68_BpoDtfCxygAE8Dq9sWoFoimxP--LPL8hDcEufJA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-regress-test-create-database-with-locale-encoding.patch application/octet-stream 2.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-05-23 12:18:03 Re: Pg upgrade bug with NOT NULL NOT VALID
Previous Message wenhui qiu 2026-05-23 10:17:26 Re: Report oldest xmin source when autovacuum cannot remove tuples