- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitea1db8a
committed
Canonicalize ICU locale names to language tags.
Convert to BCP47 language tags before storing in the catalog, exceptduring binary upgrade or when the locale comes from an existingcollation or template database.The resulting language tags can vary slightly between ICUversions. For instance, "@colBackwards=yes" is converted to"und-u-kb-true" in older versions of ICU, and to the simpler (butequivalent) "und-u-kb" in newer versions.The process of canonicalizing to a language tag also understands moreinput locale string formats than ucol_open(). For instance,"fr_CA.UTF-8" is misinterpreted by ucol_open() and the region isignored; effectively treating it the same as the locale "fr" andopening the wrong collator. Canonicalization properly interprets thelanguage and region, resulting in the language tag "fr-CA", which canthen be understood by ucol_open().This commit fixes a problem in prior versions due to ucol_open()misinterpreting locale strings as described above. For instance,creating an ICU collation with locale "fr_CA.UTF-8" would store thatstring directly in the catalog, which would later be passed to (andmisinterpreted by) ucol_open(). After this commit, the locale stringwill be canonicalized to language tag "fr-CA" in the catalog, whichwill be properly understood by ucol_open(). Because this fix affectsthe resulting collator, we cannot change the locale string stored inthe catalog for existing databases or collations; otherwise we'd riskcorrupting indexes. Therefore, only canonicalize locales fornewly-created (not upgraded) collations/databases. For similarreasons, do not backport.Discussion:https://postgr.es/m/8c7af6820aed94dc7bc259d2aa7f9663518e6137.camel@j-davis.comReviewed-by: Peter Eisentraut1 parentd3d53f9 commitea1db8a
File tree
10 files changed
+258
-27
lines changed- doc/src/sgml
- src
- backend
- commands
- utils/adt
- bin
- initdb
- t
- pg_dump/t
- include/utils
- test/regress
- expected
- sql
10 files changed
+258
-27
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
893 | 893 |
| |
894 | 894 |
| |
895 | 895 |
| |
896 |
| - | |
| 896 | + | |
897 | 897 |
| |
898 | 898 |
| |
899 | 899 |
| |
|
Lines changed: 25 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
168 | 173 |
| |
169 | 174 |
| |
170 | 175 |
| |
| |||
259 | 264 |
| |
260 | 265 |
| |
261 | 266 |
| |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
262 | 286 |
| |
263 | 287 |
| |
264 | 288 |
| |
| |||
569 | 593 |
| |
570 | 594 |
| |
571 | 595 |
| |
572 |
| - | |
573 |
| - | |
574 |
| - | |
575 |
| - | |
576 |
| - | |
577 |
| - | |
578 |
| - | |
579 |
| - | |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
590 |
| - | |
591 |
| - | |
592 | 596 |
| |
593 | 597 |
| |
594 | 598 |
| |
| |||
950 | 954 |
| |
951 | 955 |
| |
952 | 956 |
| |
953 |
| - | |
| 957 | + | |
954 | 958 |
| |
955 | 959 |
| |
956 | 960 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1058 | 1058 |
| |
1059 | 1059 |
| |
1060 | 1060 |
| |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
1061 | 1081 |
| |
1062 | 1082 |
| |
1063 | 1083 |
| |
|
Lines changed: 85 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2826 | 2826 |
| |
2827 | 2827 |
| |
2828 | 2828 |
| |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
2829 | 2914 |
| |
2830 | 2915 |
| |
2831 | 2916 |
| |
|
Lines changed: 81 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2229 | 2229 |
| |
2230 | 2230 |
| |
2231 | 2231 |
| |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
2232 | 2304 |
| |
2233 | 2305 |
| |
2234 | 2306 |
| |
| |||
2376 | 2448 |
| |
2377 | 2449 |
| |
2378 | 2450 |
| |
| 2451 | + | |
| 2452 | + | |
2379 | 2453 |
| |
2380 | 2454 |
| |
2381 | 2455 |
| |
2382 | 2456 |
| |
2383 | 2457 |
| |
2384 | 2458 |
| |
2385 | 2459 |
| |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
2386 | 2467 |
| |
2387 | 2468 |
| |
2388 | 2469 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
| 147 | + | |
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1860 | 1860 |
| |
1861 | 1861 |
| |
1862 | 1862 |
| |
1863 |
| - | |
| 1863 | + | |
1864 | 1864 |
| |
1865 |
| - | |
| 1865 | + | |
1866 | 1866 |
| |
1867 | 1867 |
| |
1868 | 1868 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
| 123 | + | |
123 | 124 |
| |
124 | 125 |
| |
125 | 126 |
| |
|
0 commit comments
Comments
(0)