mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
DefineCollation() code cleanup
Reorganize the code in DefineCollation() so that the parts using the FROM clause and the parts not doing so are more cleanly separated. No functionality change intended. Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/29ae752f-80e9-8d31-601c-62cf01cc93d8@enterprisedb.com
This commit is contained in:
parent
9198e63996
commit
e94bb1473e
@ -63,12 +63,11 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
||||
DefElem *providerEl = NULL;
|
||||
DefElem *deterministicEl = NULL;
|
||||
DefElem *versionEl = NULL;
|
||||
char *collcollate = NULL;
|
||||
char *collctype = NULL;
|
||||
char *collproviderstr = NULL;
|
||||
bool collisdeterministic = true;
|
||||
int collencoding = 0;
|
||||
char collprovider = 0;
|
||||
char *collcollate;
|
||||
char *collctype;
|
||||
bool collisdeterministic;
|
||||
int collencoding;
|
||||
char collprovider;
|
||||
char *collversion = NULL;
|
||||
Oid newoid;
|
||||
ObjectAddress address;
|
||||
@ -167,6 +166,12 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("collation \"default\" cannot be copied")));
|
||||
}
|
||||
else
|
||||
{
|
||||
char *collproviderstr = NULL;
|
||||
|
||||
collcollate = NULL;
|
||||
collctype = NULL;
|
||||
|
||||
if (localeEl)
|
||||
{
|
||||
@ -185,6 +190,8 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
||||
|
||||
if (deterministicEl)
|
||||
collisdeterministic = defGetBoolean(deterministicEl);
|
||||
else
|
||||
collisdeterministic = true;
|
||||
|
||||
if (versionEl)
|
||||
collversion = defGetString(versionEl);
|
||||
@ -201,7 +208,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
||||
errmsg("unrecognized collation provider: %s",
|
||||
collproviderstr)));
|
||||
}
|
||||
else if (!fromEl)
|
||||
else
|
||||
collprovider = COLLPROVIDER_LIBC;
|
||||
|
||||
if (!collcollate)
|
||||
@ -224,8 +231,6 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("nondeterministic collations not supported with this provider")));
|
||||
|
||||
if (!fromEl)
|
||||
{
|
||||
if (collprovider == COLLPROVIDER_ICU)
|
||||
{
|
||||
#ifdef USE_ICU
|
||||
|
Loading…
x
Reference in New Issue
Block a user