Skip to content

Commit 36f729e

Browse files
committed
Fix assertion failure in CREATE DATABASE
An assertion would fail when creating a database with libc locale provider from a template database with icu locale provider. Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e
1 parent e2fe0ae commit 36f729e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/backend/commands/dbcommands.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,10 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
10121012
dbcollate = src_collate;
10131013
if (dbctype == NULL)
10141014
dbctype = src_ctype;
1015-
if (dbiculocale == NULL)
1016-
dbiculocale = src_iculocale;
10171015
if (dblocprovider == '\0')
10181016
dblocprovider = src_locprovider;
1017+
if (dbiculocale == NULL && dblocprovider == COLLPROVIDER_ICU)
1018+
dbiculocale = src_iculocale;
10191019

10201020
/* Some encodings are client only */
10211021
if (!PG_VALID_BE_ENCODING(encoding))

src/bin/scripts/t/020_createdb.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@
4949
'--icu-locale=@colNumeric=lower', 'foobarX'
5050
],
5151
'fails for invalid ICU locale');
52+
53+
# additional node, which uses the icu provider
54+
my $node2 = PostgreSQL::Test::Cluster->new('icu');
55+
$node2->init(extra => ['--locale-provider=icu', '--icu-locale=en']);
56+
$node2->start;
57+
58+
$node2->command_ok(
59+
[ 'createdb', '-T', 'template0', '--locale-provider=libc', 'foobar55' ],
60+
'create database with libc provider from template database with icu provider');
5261
}
5362
else
5463
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy