postgresql/src/include/utils
Tom Lane b2cbced9ee Support timezone abbreviations that sometimes change.
Up to now, PG has assumed that any given timezone abbreviation (such as
"EDT") represents a constant GMT offset in the usage of any particular
region; we had a way to configure what that offset was, but not for it
to be changeable over time.  But, as with most things horological, this
view of the world is too simplistic: there are numerous regions that have
at one time or another switched to a different GMT offset but kept using
the same timezone abbreviation.  Almost the entire Russian Federation did
that a few years ago, and later this month they're going to do it again.
And there are similar examples all over the world.

To cope with this, invent the notion of a "dynamic timezone abbreviation",
which is one that is referenced to a particular underlying timezone
(as defined in the IANA timezone database) and means whatever it currently
means in that zone.  For zones that use or have used daylight-savings time,
the standard and DST abbreviations continue to have the property that you
can specify standard or DST time and get that time offset whether or not
DST was theoretically in effect at the time.  However, the abbreviations
mean what they meant at the time in question (or most recently before that
time) rather than being absolutely fixed.

The standard abbreviation-list files have been changed to use this behavior
for abbreviations that have actually varied in meaning since 1970.  The
old simple-numeric definitions are kept for abbreviations that have not
changed, since they are a bit faster to resolve.

While this is clearly a new feature, it seems necessary to back-patch it
into all active branches, because otherwise use of Russian zone
abbreviations is going to become even more problematic than it already was.
This change supersedes the changes in commit 513d06ded et al to modify the
fixed meanings of the Russian abbreviations; since we've not shipped that
yet, this will avoid an undesirably incompatible (not to mention incorrect)
change in behavior for timestamps between 2011 and 2014.

This patch makes some cosmetic changes in ecpglib to keep its usage of
datetime lookup tables as similar as possible to the backend code, but
doesn't do anything about the increasingly obsolete set of timezone
abbreviation definitions that are hard-wired into ecpglib.  Whatever we
do about that will likely not be appropriate material for back-patching.
Also, a potential free() of a garbage pointer after an out-of-memory
failure in ecpglib has been fixed.

This patch also fixes pre-existing bugs in DetermineTimeZoneOffset() that
caused it to produce unexpected results near a timezone transition, if
both the "before" and "after" states are marked as standard time.  We'd
only ever thought about or tested transitions between standard and DST
time, but that's not what's happening when a zone simply redefines their
base GMT offset.

In passing, update the SGML documentation to refer to the Olson/zoneinfo/
zic timezone database as the "IANA" database, since it's now being
maintained under the auspices of IANA.
2014-10-16 15:22:10 -04:00
..
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
acl.h Row-Level Security Policies (RLS) 2014-09-19 11:18:35 -04:00
array.h Add width_bucket(anyelement, anyarray). 2014-09-09 15:34:14 -04:00
ascii.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
attoptcache.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
builtins.h Split builtins.h to a new header ruleutils.h 2014-10-08 18:10:47 -03:00
bytea.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
cash.h Add casts from int4 and int8 to numeric. 2011-04-05 09:35:43 -04:00
catcache.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
combocid.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
date.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
datetime.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:10 -04:00
datum.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
dynahash.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
dynamic_loader.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
elog.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
evtcache.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
fmgrtab.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
formatting.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
geo_decls.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
guc.h Invent PGC_SU_BACKEND and mark log_connections/log_disconnections that way. 2014-09-13 21:01:57 -04:00
guc_tables.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
help_config.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
hsearch.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
inet.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
int8.h Provide moving-aggregate support for a bunch of numerical aggregates. 2014-04-12 20:33:09 -04:00
inval.h Introduce logical decoding. 2014-03-03 16:32:18 -05:00
json.h Revert 95d737ff to add 'ignore_nulls' 2014-09-29 13:32:22 -04:00
jsonapi.h Avoid some pnstrdup()s when constructing jsonb 2014-05-09 12:46:21 +03:00
jsonb.h Change JSONB's on-disk format for improved performance. 2014-09-29 12:29:21 -04:00
lockwaitpolicy.h Implement SKIP LOCKED for row-level locks 2014-10-07 17:23:34 -03:00
logtape.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
lsyscache.h Don't require sort support functions to provide a comparator. 2014-08-06 16:06:06 -04:00
memdebug.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
memutils.h Fix and enhance the assertion of no palloc's in a critical section. 2014-06-30 10:26:00 +03:00
nabstime.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
numeric.h Introduce jsonb, a structured format for storing json. 2014-03-23 16:40:19 -04:00
palloc.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
pg_crc.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
pg_crc_tables.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
pg_locale.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
pg_lsn.h Add btree and hash opclasses for pg_lsn. 2014-06-04 20:45:56 -04:00
pg_lzcompress.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pg_rusage.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
plancache.h Row-Level Security Policies (RLS) 2014-09-19 11:18:35 -04:00
portal.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
ps_status.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
rangetypes.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
rbtree.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
rel.h Row-Level Security Policies (RLS) 2014-09-19 11:18:35 -04:00
relcache.h Code review for recent changes in relcache.c. 2014-05-14 14:56:08 -04:00
relfilenodemap.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
relmapper.h Add rmgr callback to name xlog record types for display purposes. 2014-09-19 16:20:29 +02:00
reltrigger.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
resowner.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
resowner_private.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
ruleutils.h Split builtins.h to a new header ruleutils.h 2014-10-08 18:10:47 -03:00
selfuncs.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
snapmgr.h Introduce logical decoding. 2014-03-03 16:32:18 -05:00
snapshot.h Implement SKIP LOCKED for row-level locks 2014-10-07 17:23:34 -03:00
sortsupport.h Update comment to reflect commit 1d41739e5a. 2014-09-04 12:17:10 -04:00
spccache.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
syscache.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
timeout.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
timestamp.h Provide moving-aggregate support for a bunch of numerical aggregates. 2014-04-12 20:33:09 -04:00
tqual.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
tuplesort.h Avoid copying index tuples when building an index. 2014-07-01 10:34:42 -04:00
tuplestore.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
typcache.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
tzparser.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:10 -04:00
uuid.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
varbit.h Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:31 -05:00
xml.h Update copyright for 2014 2014-01-07 16:05:30 -05:00