@@ -1065,16 +1065,41 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
1065
1065
1066
1066
/* Check that the chosen locales are valid, and get canonical spellings */
1067
1067
if (!check_locale (LC_COLLATE , dbcollate , & canonname ))
1068
- ereport (ERROR ,
1069
- (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1070
- errmsg ("invalid LC_COLLATE locale name: \"%s\"" , dbcollate ),
1071
- errhint ("If the locale name is specific to ICU, use ICU_LOCALE." )));
1068
+ {
1069
+ if (dblocprovider == COLLPROVIDER_BUILTIN )
1070
+ ereport (ERROR ,
1071
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1072
+ errmsg ("invalid LC_COLLATE locale name: \"%s\"" , dbcollate ),
1073
+ errhint ("If the locale name is specific to the builtin provider, use BUILTIN_LOCALE." )));
1074
+ else if (dblocprovider == COLLPROVIDER_ICU )
1075
+ ereport (ERROR ,
1076
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1077
+ errmsg ("invalid LC_COLLATE locale name: \"%s\"" , dbcollate ),
1078
+ errhint ("If the locale name is specific to the ICU provider, use ICU_LOCALE." )));
1079
+ else
1080
+ ereport (ERROR ,
1081
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1082
+ errmsg ("invalid LC_COLLATE locale name: \"%s\"" , dbcollate )));
1083
+ }
1072
1084
dbcollate = canonname ;
1073
1085
if (!check_locale (LC_CTYPE , dbctype , & canonname ))
1074
- ereport (ERROR ,
1075
- (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1076
- errmsg ("invalid LC_CTYPE locale name: \"%s\"" , dbctype ),
1077
- errhint ("If the locale name is specific to ICU, use ICU_LOCALE." )));
1086
+ {
1087
+ if (dblocprovider == COLLPROVIDER_BUILTIN )
1088
+ ereport (ERROR ,
1089
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1090
+ errmsg ("invalid LC_CTYPE locale name: \"%s\"" , dbctype ),
1091
+ errhint ("If the locale name is specific to the builtin provider, use BUILTIN_LOCALE." )));
1092
+ else if (dblocprovider == COLLPROVIDER_ICU )
1093
+ ereport (ERROR ,
1094
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1095
+ errmsg ("invalid LC_CTYPE locale name: \"%s\"" , dbctype ),
1096
+ errhint ("If the locale name is specific to the ICU provider, use ICU_LOCALE." )));
1097
+ else
1098
+ ereport (ERROR ,
1099
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1100
+ errmsg ("invalid LC_CTYPE locale name: \"%s\"" , dbctype )));
1101
+ }
1102
+
1078
1103
dbctype = canonname ;
1079
1104
1080
1105
check_encoding_locale_matches (encoding , dbcollate , dbctype );
0 commit comments