forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita88b6e4
committed
setlocale() on Windows doesn't work correctly if the locale name contains
dots. I previously worked around this in initdb, mapping the knownproblematic locale names to aliases that work, but Hiroshi Inoue pointedout that that's not enough because even if you use one of the aliases, like"Chinese_HKG", setlocale(LC_CTYPE, NULL) returns back the long form, ie."Chinese_Hong Kong S.A.R.". When we try to restore an old locale value bypassing that value back to setlocale(), it fails. Note that you are affectedby this bug also if you use one of those short-form names manually, so justreverting the hack in initdb won't fix it.To work around that, move the locale name mapping from initdb to a wrapperaround setlocale(), so that the mapping is invoked on every setlocale() call.Also, add a few checks for failed setlocale() calls in the backend. Thesecalls shouldn't fail, and if they do there isn't much we can do about it,but at least you'll get a warning.Backpatch to 9.1, where the initdb hack was introduced. The Windows bugaffects older versions too if you set locale manually to one of the aliases,but given the lack of complaints from the field, I'm hesitent to backpatch.1 parent8ea0257 commita88b6e4
File tree
4 files changed
+138
-70
lines changed- src
- backend/utils/adt
- bin/initdb
- include
- port
4 files changed
+138
-70
lines changedLines changed: 13 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
239 | 239 |
| |
240 | 240 |
| |
241 | 241 |
| |
242 |
| - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
243 | 245 |
| |
244 | 246 |
| |
245 | 247 |
| |
| |||
499 | 501 |
| |
500 | 502 |
| |
501 | 503 |
| |
502 |
| - | |
| 504 | + | |
| 505 | + | |
503 | 506 |
| |
504 | 507 |
| |
505 | 508 |
| |
506 | 509 |
| |
507 | 510 |
| |
508 |
| - | |
| 511 | + | |
| 512 | + | |
509 | 513 |
| |
510 | 514 |
| |
511 | 515 |
| |
512 | 516 |
| |
513 | 517 |
| |
514 | 518 |
| |
515 | 519 |
| |
516 |
| - | |
| 520 | + | |
| 521 | + | |
517 | 522 |
| |
518 | 523 |
| |
519 | 524 |
| |
| |||
674 | 679 |
| |
675 | 680 |
| |
676 | 681 |
| |
677 |
| - | |
| 682 | + | |
| 683 | + | |
678 | 684 |
| |
679 | 685 |
| |
680 | 686 |
| |
681 | 687 |
| |
682 | 688 |
| |
683 | 689 |
| |
684 | 690 |
| |
685 |
| - | |
| 691 | + | |
| 692 | + | |
686 | 693 |
| |
687 | 694 |
| |
688 | 695 |
| |
|
Lines changed: 7 additions & 63 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
185 | 185 |
| |
186 | 186 |
| |
187 | 187 |
| |
188 |
| - | |
189 | 188 |
| |
190 | 189 |
| |
191 | 190 |
| |
| |||
2286 | 2285 |
| |
2287 | 2286 |
| |
2288 | 2287 |
| |
2289 |
| - | |
2290 |
| - | |
2291 |
| - | |
2292 |
| - | |
2293 |
| - | |
2294 |
| - | |
2295 |
| - | |
2296 |
| - | |
2297 |
| - | |
2298 |
| - | |
2299 |
| - | |
2300 |
| - | |
2301 |
| - | |
2302 |
| - | |
2303 |
| - | |
2304 |
| - | |
2305 |
| - | |
2306 |
| - | |
2307 |
| - | |
2308 |
| - | |
2309 |
| - | |
2310 |
| - | |
2311 |
| - | |
2312 |
| - | |
2313 |
| - | |
2314 |
| - | |
2315 |
| - | |
2316 |
| - | |
2317 |
| - | |
2318 |
| - | |
2319 |
| - | |
2320 |
| - | |
2321 |
| - | |
2322 |
| - | |
2323 |
| - | |
2324 |
| - | |
2325 |
| - | |
2326 |
| - | |
2327 |
| - | |
2328 |
| - | |
2329 |
| - | |
2330 |
| - | |
2331 |
| - | |
2332 |
| - | |
2333 |
| - | |
2334 |
| - | |
2335 |
| - | |
2336 |
| - | |
2337 |
| - | |
2338 |
| - | |
2339 |
| - | |
2340 |
| - | |
2341 |
| - | |
2342 |
| - | |
2343 |
| - | |
2344 | 2288 |
| |
2345 | 2289 |
| |
2346 | 2290 |
| |
| |||
2372 | 2316 |
| |
2373 | 2317 |
| |
2374 | 2318 |
| |
2375 |
| - | |
| 2319 | + | |
2376 | 2320 |
| |
2377 |
| - | |
| 2321 | + | |
2378 | 2322 |
| |
2379 |
| - | |
| 2323 | + | |
2380 | 2324 |
| |
2381 |
| - | |
| 2325 | + | |
2382 | 2326 |
| |
2383 |
| - | |
| 2327 | + | |
2384 | 2328 |
| |
2385 | 2329 |
| |
2386 | 2330 |
| |
2387 | 2331 |
| |
2388 |
| - | |
| 2332 | + | |
2389 | 2333 |
| |
2390 | 2334 |
| |
2391 | 2335 |
| |
2392 | 2336 |
| |
2393 |
| - | |
| 2337 | + | |
2394 | 2338 |
| |
2395 | 2339 |
| |
2396 | 2340 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
226 | 226 |
| |
227 | 227 |
| |
228 | 228 |
| |
| 229 | + | |
229 | 230 |
| |
230 | 231 |
| |
231 | 232 |
| |
232 | 233 |
| |
233 | 234 |
| |
234 | 235 |
| |
235 |
| - | |
| 236 | + | |
236 | 237 |
| |
237 | 238 |
| |
238 | 239 |
| |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
239 | 250 |
| |
240 | 251 |
| |
241 | 252 |
| |
|
Lines changed: 106 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
356 | 356 |
| |
357 | 357 |
| |
358 | 358 |
| |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + |
0 commit comments
Comments
(0)