@@ -64,10 +64,12 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
64
64
DefElem * lcctypeEl = NULL ;
65
65
DefElem * providerEl = NULL ;
66
66
DefElem * deterministicEl = NULL ;
67
+ DefElem * rulesEl = NULL ;
67
68
DefElem * versionEl = NULL ;
68
69
char * collcollate ;
69
70
char * collctype ;
70
71
char * colliculocale ;
72
+ char * collicurules ;
71
73
bool collisdeterministic ;
72
74
int collencoding ;
73
75
char collprovider ;
@@ -99,6 +101,8 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
99
101
defelp = & providerEl ;
100
102
else if (strcmp (defel -> defname , "deterministic" ) == 0 )
101
103
defelp = & deterministicEl ;
104
+ else if (strcmp (defel -> defname , "rules" ) == 0 )
105
+ defelp = & rulesEl ;
102
106
else if (strcmp (defel -> defname , "version" ) == 0 )
103
107
defelp = & versionEl ;
104
108
else
@@ -161,6 +165,12 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
161
165
else
162
166
colliculocale = NULL ;
163
167
168
+ datum = SysCacheGetAttr (COLLOID , tp , Anum_pg_collation_collicurules , & isnull );
169
+ if (!isnull )
170
+ collicurules = TextDatumGetCString (datum );
171
+ else
172
+ collicurules = NULL ;
173
+
164
174
ReleaseSysCache (tp );
165
175
166
176
/*
@@ -182,6 +192,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
182
192
collcollate = NULL ;
183
193
collctype = NULL ;
184
194
colliculocale = NULL ;
195
+ collicurules = NULL ;
185
196
186
197
if (providerEl )
187
198
collproviderstr = defGetString (providerEl );
@@ -191,6 +202,9 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
191
202
else
192
203
collisdeterministic = true;
193
204
205
+ if (rulesEl )
206
+ collicurules = defGetString (rulesEl );
207
+
194
208
if (versionEl )
195
209
collversion = defGetString (versionEl );
196
210
@@ -297,6 +311,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
297
311
collcollate ,
298
312
collctype ,
299
313
colliculocale ,
314
+ collicurules ,
300
315
collversion ,
301
316
if_not_exists ,
302
317
false); /* not quiet */
@@ -680,7 +695,7 @@ create_collation_from_locale(const char *locale, int nspid,
680
695
*/
681
696
collid = CollationCreate (locale , nspid , GetUserId (),
682
697
COLLPROVIDER_LIBC , true, enc ,
683
- locale , locale , NULL ,
698
+ locale , locale , NULL , NULL ,
684
699
get_collation_actual_version (COLLPROVIDER_LIBC , locale ),
685
700
true, true);
686
701
if (OidIsValid (collid ))
@@ -755,7 +770,7 @@ win32_read_locale(LPWSTR pStr, DWORD dwFlags, LPARAM lparam)
755
770
756
771
collid = CollationCreate (alias , param -> nspid , GetUserId (),
757
772
COLLPROVIDER_LIBC , true, enc ,
758
- localebuf , localebuf , NULL ,
773
+ localebuf , localebuf , NULL , NULL ,
759
774
get_collation_actual_version (COLLPROVIDER_LIBC , localebuf ),
760
775
true, true);
761
776
if (OidIsValid (collid ))
@@ -889,7 +904,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
889
904
890
905
collid = CollationCreate (alias , nspid , GetUserId (),
891
906
COLLPROVIDER_LIBC , true, enc ,
892
- locale , locale , NULL ,
907
+ locale , locale , NULL , NULL ,
893
908
get_collation_actual_version (COLLPROVIDER_LIBC , locale ),
894
909
true, true);
895
910
if (OidIsValid (collid ))
@@ -951,7 +966,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
951
966
collid = CollationCreate (psprintf ("%s-x-icu" , langtag ),
952
967
nspid , GetUserId (),
953
968
COLLPROVIDER_ICU , true, -1 ,
954
- NULL , NULL , iculocstr ,
969
+ NULL , NULL , iculocstr , NULL ,
955
970
get_collation_actual_version (COLLPROVIDER_ICU , iculocstr ),
956
971
true, true);
957
972
if (OidIsValid (collid ))
0 commit comments