postgresql/src
Tom Lane 631dc390f4 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_timezone
variable was not updated to match the nominal timezone; rather, all code
was expected to ignore session_timezone if HasCTZSet was true.  This is
of course obviously fragile, though a search of the code finds only
timeofday() failing to honor the rule.  A bigger problem was that
DetermineTimeZoneOffset() supposed that if its pg_tz parameter was
pointer-equal to session_timezone, then HasCTZSet should override the
parameter.  This would cause datetime input containing an explicit zone
name to be treated as referencing the brute-force zone instead, if the
zone name happened to match the session timezone that had prevailed
before 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 zone
specification, which we can do using the POSIX timezone definition syntax
"<abbrev>offset", and get rid of the bogus lookaside check in
DetermineTimeZoneOffset().  Aside from fixing the erroneous behavior in
datetime parsing and AT TIME ZONE, this will cause the timeofday() function
to print its result in the user-requested time zone rather than some
previously-set zone.  It might also affect results in third-party
extensions, if there are any that make use of session_timezone without
considering HasCTZSet, but in all cases the new behavior should be saner
than before.

Back-patch to all supported branches.
2013-11-01 12:13:18 -04:00
..
backend Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:18 -04:00
bin Ignore SIGSYS during initdb. 2013-10-24 21:51:30 -04:00
common Use improved vsnprintf calling logic in more places. 2013-10-24 21:43:57 -04:00
include Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:18 -04:00
interfaces Improve pqexpbuffer.c to use modern vsnprintf implementations efficiently. 2013-10-25 17:42:26 -04:00
makefiles Ensure installation dirs are built before contents are installed (v2) 2013-09-30 10:17:30 -04:00
pl Use improved vsnprintf calling logic in more places. 2013-10-24 21:43:57 -04:00
port Get rid of use of asprintf() in favor of a more portable implementation. 2013-10-22 18:42:13 -04:00
template Remove _FORTIFY_SOURCE 2012-10-10 21:42:38 -04:00
test Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:18 -04:00
timezone Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:18 -04:00
tools Prevent using strncpy with src == dest in TupleDescInitEntry. 2013-10-28 20:49:24 -04:00
tutorial Modernize string literal syntax in tutorial example. 2013-01-19 17:20:32 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Switch dependency order of libpgcommon and libpgport 2013-10-17 22:02:35 -04:00
Makefile.shlib Remove IRIX port. 2013-10-18 08:14:21 -04:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00