forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit631dc39
committed
Fix some odd behaviors when using a SQL-style simple GMT offset timezone.
Formerly, when using a SQL-spec timezone setting with a fixed GMT offset(called a "brute force" timezone in the code), the session_timezonevariable was not updated to match the nominal timezone; rather, all codewas expected to ignore session_timezone if HasCTZSet was true. This isof course obviously fragile, though a search of the code finds onlytimeofday() failing to honor the rule. A bigger problem was thatDetermineTimeZoneOffset() supposed that if its pg_tz parameter waspointer-equal to session_timezone, then HasCTZSet should override theparameter. This would cause datetime input containing an explicit zonename to be treated as referencing the brute-force zone instead, if thezone name happened to match the session timezone that had prevailedbefore installing the brute-force zone setting (as reported in bug #8572).The same malady could affect AT TIME ZONE operators.To fix, set up session_timezone so that it matches the brute-force zonespecification, which we can do using the POSIX timezone definition syntax"<abbrev>offset", and get rid of the bogus lookaside check inDetermineTimeZoneOffset(). Aside from fixing the erroneous behavior indatetime parsing and AT TIME ZONE, this will cause the timeofday() functionto print its result in the user-requested time zone rather than somepreviously-set zone. It might also affect results in third-partyextensions, if there are any that make use of session_timezone withoutconsidering HasCTZSet, but in all cases the new behavior should be sanerthan before.Back-patch to all supported branches.1 parentcacbdd7 commit631dc39
File tree
6 files changed
+89
-6
lines changed- src
- backend
- commands
- utils/adt
- include
- test/regress
- expected
- sql
- timezone
6 files changed
+89
-6
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
| 330 | + | |
330 | 331 |
| |
331 | 332 |
| |
332 | 333 |
| |
| |||
341 | 342 |
| |
342 | 343 |
| |
343 | 344 |
| |
| 345 | + | |
344 | 346 |
| |
345 | 347 |
| |
346 | 348 |
| |
|
Lines changed: 0 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1465 | 1465 |
| |
1466 | 1466 |
| |
1467 | 1467 |
| |
1468 |
| - | |
1469 |
| - | |
1470 |
| - | |
1471 |
| - | |
1472 |
| - | |
1473 |
| - | |
1474 | 1468 |
| |
1475 | 1469 |
| |
1476 | 1470 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| 71 | + | |
71 | 72 |
| |
72 | 73 |
| |
73 | 74 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2935 | 2935 |
| |
2936 | 2936 |
| |
2937 | 2937 |
| |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + |
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + |
Lines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
288 | 288 |
| |
289 | 289 |
| |
290 | 290 |
| |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
291 | 331 |
| |
292 | 332 |
| |
293 | 333 |
| |
|
0 commit comments
Comments
(0)