0001-Do-not-copy-datlocale-unless-datlocprovider-matches.patch

text/x-patch

Filename: 0001-Do-not-copy-datlocale-unless-datlocprovider-matches.patch
Type: text/x-patch
Part: 0
Message: CREATE DATABASE copies datlocale even if datlocprovider differs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0001
Subject: Do not copy datlocale unless datlocprovider matches.
File+
src/backend/commands/dbcommands.c 1 1
From 7617f154b4c10e181eeeb949d773b5f1eee67954 Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Tue, 29 Jul 2025 16:11:32 -0700
Subject: [PATCH] Do not copy datlocale unless datlocprovider matches.

During CREATE DATABASE, if changing the locale provider, require that
a new locale is specified rather than trying to reinterpret the old
locale with the new provider.
---
 src/backend/commands/dbcommands.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 502a45163c8..92a396b8406 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -1052,7 +1052,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
 		dbctype = src_ctype;
 	if (dblocprovider == '\0')
 		dblocprovider = src_locprovider;
-	if (dblocale == NULL)
+	if (dblocale == NULL && dblocprovider == src_locprovider)
 		dblocale = src_locale;
 	if (dbicurules == NULL)
 		dbicurules = src_icurules;
-- 
2.43.0