Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54baa48

Browse files
committed
Copy collencoding in CREATE COLLATION / FROM
This command used to compute the collencoding entry like when acompletely new collation is created. But for example when copying the"C" collation, this would then result in a collation that has acollencoding entry for the current database encoding rather than -1,thus not making an exact copy. This has probably no practical impact,but making this change keeps the catalog contents neat.Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
1 parent08aed66 commit54baa48

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/backend/commands/collationcmds.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
6464
char*collcollate=NULL;
6565
char*collctype=NULL;
6666
char*collproviderstr=NULL;
67-
intcollencoding;
67+
intcollencoding=0;
6868
charcollprovider=0;
6969
char*collversion=NULL;
7070
Oidnewoid;
@@ -126,6 +126,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
126126
collcollate=pstrdup(NameStr(((Form_pg_collation)GETSTRUCT(tp))->collcollate));
127127
collctype=pstrdup(NameStr(((Form_pg_collation)GETSTRUCT(tp))->collctype));
128128
collprovider= ((Form_pg_collation)GETSTRUCT(tp))->collprovider;
129+
collencoding= ((Form_pg_collation)GETSTRUCT(tp))->collencoding;
129130

130131
ReleaseSysCache(tp);
131132

@@ -185,12 +186,15 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
185186
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
186187
errmsg("parameter \"lc_ctype\" must be specified")));
187188

188-
if (collprovider==COLLPROVIDER_ICU)
189-
collencoding=-1;
190-
else
189+
if (!fromEl)
191190
{
192-
collencoding=GetDatabaseEncoding();
193-
check_encoding_locale_matches(collencoding,collcollate,collctype);
191+
if (collprovider==COLLPROVIDER_ICU)
192+
collencoding=-1;
193+
else
194+
{
195+
collencoding=GetDatabaseEncoding();
196+
check_encoding_locale_matches(collencoding,collcollate,collctype);
197+
}
194198
}
195199

196200
if (!collversion)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp