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 *providerEl = NULL;
|
||||||
DefElem *deterministicEl = NULL;
|
DefElem *deterministicEl = NULL;
|
||||||
DefElem *versionEl = NULL;
|
DefElem *versionEl = NULL;
|
||||||
char *collcollate = NULL;
|
char *collcollate;
|
||||||
char *collctype = NULL;
|
char *collctype;
|
||||||
char *collproviderstr = NULL;
|
bool collisdeterministic;
|
||||||
bool collisdeterministic = true;
|
int collencoding;
|
||||||
int collencoding = 0;
|
char collprovider;
|
||||||
char collprovider = 0;
|
|
||||||
char *collversion = NULL;
|
char *collversion = NULL;
|
||||||
Oid newoid;
|
Oid newoid;
|
||||||
ObjectAddress address;
|
ObjectAddress address;
|
||||||
@ -167,6 +166,12 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
|||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("collation \"default\" cannot be copied")));
|
errmsg("collation \"default\" cannot be copied")));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *collproviderstr = NULL;
|
||||||
|
|
||||||
|
collcollate = NULL;
|
||||||
|
collctype = NULL;
|
||||||
|
|
||||||
if (localeEl)
|
if (localeEl)
|
||||||
{
|
{
|
||||||
@ -185,6 +190,8 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
|||||||
|
|
||||||
if (deterministicEl)
|
if (deterministicEl)
|
||||||
collisdeterministic = defGetBoolean(deterministicEl);
|
collisdeterministic = defGetBoolean(deterministicEl);
|
||||||
|
else
|
||||||
|
collisdeterministic = true;
|
||||||
|
|
||||||
if (versionEl)
|
if (versionEl)
|
||||||
collversion = defGetString(versionEl);
|
collversion = defGetString(versionEl);
|
||||||
@ -201,7 +208,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
|||||||
errmsg("unrecognized collation provider: %s",
|
errmsg("unrecognized collation provider: %s",
|
||||||
collproviderstr)));
|
collproviderstr)));
|
||||||
}
|
}
|
||||||
else if (!fromEl)
|
else
|
||||||
collprovider = COLLPROVIDER_LIBC;
|
collprovider = COLLPROVIDER_LIBC;
|
||||||
|
|
||||||
if (!collcollate)
|
if (!collcollate)
|
||||||
@ -224,8 +231,6 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
|
|||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("nondeterministic collations not supported with this provider")));
|
errmsg("nondeterministic collations not supported with this provider")));
|
||||||
|
|
||||||
if (!fromEl)
|
|
||||||
{
|
|
||||||
if (collprovider == COLLPROVIDER_ICU)
|
if (collprovider == COLLPROVIDER_ICU)
|
||||||
{
|
{
|
||||||
#ifdef USE_ICU
|
#ifdef USE_ICU
|
||||||
|
Loading…
x
Reference in New Issue
Block a user