forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit995b4fe
committed
Attempt to identify system timezone by reading /etc/localtime symlink.
On many modern platforms, /etc/localtime is a symlink to a file within theIANA database. Reading the symlink lets us find out the name of the systemtimezone directly, without going through the brute-force search embodied inscan_available_timezones(). This shortens the runtime of initdb by sometens of ms, which is helpful for the buildfarm, and it also allows us toreliably select the same zone name the system was actually configured for,rather than possibly choosing one of IANA's many zone aliases. (Forexample, in a system configured for "Asia/Tokyo", the brute-force searchwould not choose that name but its alias "Japan", on the grounds of thelatter string being shorter. More surprisingly, "Navajo" is preferredto either "America/Denver" or "US/Mountain", as seen in an old complaintfrom Josh Berkus.)If /etc/localtime doesn't exist, or isn't a symlink, or we can't makesense of its contents, or the contents match a zone we know but thatzone doesn't match the observed behavior of localtime(), fall back tothe brute-force search.Also, tweak initdb so that it prints the zone name it selected.In passing, replace the last few references to the "Olson" database incode comments with "IANA", as that's been our preferred term sincecommitb2cbced.Back-patch of commit23bd3ce. The original intention was to notback-patch, since this can result in cosmetic behavioral changes ---for example, on my own workstation initdb now chooses "America/New_York",where it used to prefer "US/Eastern" which is equivalent and shorter.However, our hand has been more or less forced by tzdb update 2019a,which made the "UCT" zone fully equivalent to "UTC". Our old codenow prefers "UCT" on the grounds of it being alphabetically first,and that's making nobody happy. Choosing the alias indicated by/etc/localtime is a more defensible behavior. (Users who don't likethe results can always force the decision by setting the TZ environmentvariable before running initdb.)Patch by me, per a suggestion from Robert Haas; review by Michael PaquierDiscussion:https://postgr.es/m/7408.1525812528@sss.pgh.pa.usDiscussion:https://postgr.es/m/20190604085735.GD24018@msg.df7cb.de1 parent85600b7 commit995b4fe
File tree
3 files changed
+133
-13
lines changed- src
- bin/initdb
- interfaces/ecpg/pgtypeslib
3 files changed
+133
-13
lines changedLines changed: 126 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
126 | 127 |
| |
127 | 128 |
| |
128 | 129 |
| |
129 |
| - | |
| 130 | + | |
130 | 131 |
| |
131 | 132 |
| |
132 | 133 |
| |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
133 | 141 |
| |
134 |
| - | |
| 142 | + | |
135 | 143 |
| |
136 | 144 |
| |
137 | 145 |
| |
| |||
150 | 158 |
| |
151 | 159 |
| |
152 | 160 |
| |
| 161 | + | |
| 162 | + | |
153 | 163 |
| |
154 | 164 |
| |
155 | 165 |
| |
| |||
299 | 309 |
| |
300 | 310 |
| |
301 | 311 |
| |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
302 | 321 |
| |
303 | 322 |
| |
304 | 323 |
| |
305 |
| - | |
306 |
| - | |
307 |
| - | |
| 324 | + | |
308 | 325 |
| |
309 | 326 |
| |
310 | 327 |
| |
| |||
339 | 356 |
| |
340 | 357 |
| |
341 | 358 |
| |
342 |
| - | |
| 359 | + | |
343 | 360 |
| |
344 | 361 |
| |
345 | 362 |
| |
| |||
374 | 391 |
| |
375 | 392 |
| |
376 | 393 |
| |
377 |
| - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
378 | 406 |
| |
379 | 407 |
| |
380 | 408 |
| |
| |||
383 | 411 |
| |
384 | 412 |
| |
385 | 413 |
| |
386 |
| - | |
| 414 | + | |
387 | 415 |
| |
388 | 416 |
| |
389 | 417 |
| |
| |||
472 | 500 |
| |
473 | 501 |
| |
474 | 502 |
| |
475 |
| - | |
| 503 | + | |
476 | 504 |
| |
477 | 505 |
| |
478 | 506 |
| |
| |||
486 | 514 |
| |
487 | 515 |
| |
488 | 516 |
| |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
489 | 605 |
| |
490 | 606 |
| |
491 | 607 |
| |
| |||
586 | 702 |
| |
587 | 703 |
| |
588 | 704 |
| |
589 |
| - | |
| 705 | + | |
590 | 706 |
| |
591 | 707 |
| |
592 | 708 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| 177 | + | |
177 | 178 |
| |
178 | 179 |
| |
179 | 180 |
| |
| |||
1050 | 1051 |
| |
1051 | 1052 |
| |
1052 | 1053 |
| |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
1053 | 1059 |
| |
1054 | 1060 |
| |
1055 | 1061 |
| |
| |||
1082 | 1088 |
| |
1083 | 1089 |
| |
1084 | 1090 |
| |
1085 |
| - | |
1086 | 1091 |
| |
1087 | 1092 |
| |
1088 | 1093 |
| |
| |||
1164 | 1169 |
| |
1165 | 1170 |
| |
1166 | 1171 |
| |
1167 |
| - | |
1168 | 1172 |
| |
1169 | 1173 |
| |
1170 | 1174 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
833 | 833 |
| |
834 | 834 |
| |
835 | 835 |
| |
836 |
| - | |
| 836 | + | |
837 | 837 |
| |
838 | 838 |
| |
839 | 839 |
| |
|
0 commit comments
Comments
(0)