Commit Graph

66 Commits

Author SHA1 Message Date
Tom Lane 39b691f251 Don't require dynamic timezone abbreviations to match underlying time zone.
Previously, we threw an error if a dynamic timezone abbreviation did not
match any abbreviation recorded in the referenced IANA time zone entry.
That seemed like a good consistency check at the time, but it turns out
that a number of the abbreviations in the IANA database are things that
Olson and crew made up out of whole cloth.  Their current policy is to
remove such names in favor of using simple numeric offsets.  Perhaps
unsurprisingly, a lot of these made-up abbreviations have varied in meaning
over time, which meant that our commit b2cbced9e and later changes made
them into dynamic abbreviations.  So with newer IANA database versions
that don't mention these abbreviations at all, we fail, as reported in bug
#14307 from Neil Anderson.  It's worse than just a few unused-in-the-wild
abbreviations not working, because the pg_timezone_abbrevs view stops
working altogether (since its underlying function tries to compute the
whole view result in one call).

We considered deleting these abbreviations from our abbreviations list, but
the problem with that is that we can't stay ahead of possible future IANA
changes.  Instead, let's leave the abbreviations list alone, and treat any
"orphaned" dynamic abbreviation as just meaning the referenced time zone.
It will behave a bit differently than it used to, in that you can't any
longer override the zone's standard vs. daylight rule by using the "wrong"
abbreviation of a pair, but that's better than failing entirely.  (Also,
this solution can be interpreted as adding a small new feature, which is
that any abbreviation a user wants can be defined as referencing a time
zone name.)

Back-patch to all supported branches, since this problem affects all
of them when using tzdata 2016f or newer.

Report: <20160902031551.15674.67337@wrigleys.postgresql.org>
Discussion: <6189.1472820913@sss.pgh.pa.us>
2016-09-02 17:30:02 -04:00
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
Tom Lane 92df220343 Improve documentation around historical calendar rules.
Get rid of section 8.5.6 (Date/Time Internals), which appears to confuse
people more than it helps, and anyway discussion of Postgres' internal
datetime calculation methods seems pretty out of place here.  Instead,
make datatype.sgml just say that we follow the Gregorian calendar (a bit
of specification not previously present anywhere in that chapter :-()
and link to the History of Units appendix for more info.  Do some mild
editorialization on that appendix, too, to make it clearer that we are
following proleptic Gregorian calendar rules rather than anything more
historically accurate.

Per a question from Florence Cousin and subsequent discussion in
pgsql-docs.
2012-04-26 18:28:52 -04:00
Bruce Momjian 03c25dd900 Mark all GUC variables with <varname> markup, rather than <literal>. 2011-02-02 18:06:38 -05:00
Peter Eisentraut fc946c39ae Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Tom Lane 0fd85d7879 Remove the datetime keywords ABSTIME and RELTIME, which we'd been treating as
noise words for the last twelve years, for compatibility with Berkeley-era
output formatting of the special INVALID values for those datatypes.
Considering that the datatypes themselves have been deprecated for awhile,
this is taking backwards compatibility a little far.  Per gripe from Josh
Berkus.
2009-03-22 01:12:32 +00:00
Tom Lane 2874d38d7f Update docs to reflect the fact that we can now deal with DST rules
outside the 32-bit-time_t range.  Also, refer to Olson's tz database
as the 'zoneinfo' database, a name that upstream sometimes uses, not
'zic database' which they never use.
2008-02-16 21:51:04 +00:00
Tom Lane 164d255b49 Improve documentation about Julian dates; in particular, point out the
difference between Julian and Gregorian reckoning of when JD 0 was.
2007-12-15 01:18:34 +00:00
Tom Lane 3b3251cb95 Ensure that all <sect1> and <refentry> tags have IDs. This is needed
to ensure that the resulting webpages have predictable URLs, instead of
ever-changing numeric IDs.  The new contrib docs were the biggest
offender, but some old stuff had the problem too.  Also, rename a couple
of new contrib sgml files for consistency's sake.
2007-12-02 22:33:20 +00:00
Bruce Momjian a134ee3379 Update documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".

Also update two error messages mentioned in the documenation to match.
2007-01-31 20:56:20 +00:00
Tom Lane 022fd99668 Fix up some problems in handling of zic-style time zone names in datetime
input routines.  Remove the former "DecodePosixTimezone" function in favor of
letting the zic code handle POSIX-style zone specs (see tzparse()).  In
particular this means that "PST+3" now means the same as "-03", whereas it
used to mean "-11" --- the zone abbreviation is effectively just a noise word
in this syntax.  Make sure that all named and POSIX-style zone names will be
parsed as a single token.  Fix long-standing bogosities in printing and input
of fractional-hour timezone offsets (since the tzparse() code will accept
these, we'd better make 'em work).  Also correct an error in the original
coding of the zic-zone-name patch: in "timestamp without time zone" input,
zone names are supposed to be allowed but ignored, but the coding was such
that the zone changed the interpretation anyway.
2006-10-17 21:03:21 +00:00
Tom Lane ceefbbf718 Move incorrectly-located indexterm entry. 2006-09-22 16:35:55 +00:00
Tom Lane e893e87530 Update timezone documentation to reflect current reality: instead of
giving tables of known timezone names, refer the user to the system views.
Joachim Wieland
2006-09-22 16:20:00 +00:00
Bruce Momjian 32cebaecff Remove emacs info from footer of SGML files. 2006-09-16 00:30:20 +00:00
Tom Lane d8b5c95ca8 Remove hard-wired lists of timezone abbreviations in favor of providing
configuration files that can be altered by a DBA.  The australian_timezones
GUC setting disappears, replaced by a timezone_abbreviations setting (set this
to 'Australia' to get the effect of australian_timezones).  The list of zone
names defined by default has undergone a bit of cleanup, too.  Documentation
still needs some work --- in particular, should we fix Table B-4, or just get
rid of it?  Joachim Wieland, with some editorializing by moi.
2006-07-25 03:51:23 +00:00
Bruce Momjian a77275fe3b Please find attached two patches for documentation and regression tests
for the usage of full time zone names.

Joachim Wieland
2006-07-06 01:46:38 +00:00
Bruce Momjian efe3de07e9 Removes or minimizes some documentation mentions of backward
compatibility for release 7.2 and earlier.  I have not altered any
mentions of release 7.3 or later.  The release notes were not modified,
so the changes are still documented, just not in the main docs.
2006-04-23 03:39:52 +00:00
Bruce Momjian 497b5ad928 Make $PostgreSQL CVS tags consistent for SGML files. 2006-03-10 19:10:50 +00:00
Tom Lane a239af02c3 Fix the various forms of AT TIME ZONE to accept either timezones found
in the zic database or zone names found in the date token table.  This
preserves the old ability to do AT TIME ZONE 'PST' along with the new
ability to do AT TIME ZONE 'PST8PDT'.  Per gripe from Bricklen Anderson.
Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old
code had the potential for one-byte buffer overruns, though given
alignment considerations it's unlikely there was any real risk.
2005-09-09 02:31:50 +00:00
Bruce Momjian 0851a6fbc7 This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Magnus Hagander
2005-06-15 00:34:11 +00:00
Tom Lane 7da8623a56 Last batch of updates in response to 7.4 interactive docs comments. 2005-01-09 18:58:10 +00:00
Tom Lane 31cc047d94 BDST should be "British double SUMMER time", not Standard time.
Per John Smith.
2004-12-28 15:25:55 +00:00
Neil Conway ec7a6bd9a2 Replace "--" and "---" with "&mdash;" as appropriate, for better-looking
output.
2004-11-15 06:32:15 +00:00
Tom Lane 97b1ac1aef Update documentation to reflect the fact that we now know exactly what
time zone names we support.
2004-08-10 00:55:08 +00:00
Bruce Momjian a302b8e150 Back out tutorial changes:
---------------------------------------------------------------------------

1.  In keeping with the recent discussion that there should be more
said about views, stored procedures, and triggers, in the tutorial, I
have added a bit of verbiage to that end.

2.  Some formatting changes to the datetime discussion, as well as
addition of a citation of a relevant book on calendars.

Christopher Browne
2004-03-31 16:20:53 +00:00
Bruce Momjian aaad011940 1. In keeping with the recent discussion that there should be more
said about views, stored procedures, and triggers, in the tutorial, I
have added a bit of verbiage to that end.

2.  Some formatting changes to the datetime discussion, as well as
addition of a citation of a relevant book on calendars.

Christopher Browne
2004-03-30 21:58:20 +00:00
Tom Lane af03663878 Minor wordsmithing in datetime docs to try to address gripes raised by
cnliou.
2003-12-01 20:34:53 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Tom Lane e1b47c2dbd Minor copy-editing. 2003-11-06 22:21:47 +00:00
Tom Lane f3ad615ce8 Fix a batch of speling misteaks identified by Peter's spell-checker tool. 2003-09-20 20:12:05 +00:00
Bruce Momjian d768cb267b seemed like a typo in one of the appendix tables
Robert Treat
2003-09-11 16:22:42 +00:00
Peter Eisentraut c326d8f4f2 Add/edit index entries. 2003-08-31 17:32:24 +00:00
Tom Lane 3e51c1553c Add the Brazilian time zone abbreviations BRT, BRST, FNT, FNST.
ACT and ACST were already present.  AMT and AMST conflict with the
existing entries for Armenia; no change there for the moment.
2003-08-25 23:30:27 +00:00
Tom Lane 9c2a7c2269 Apply (a somewhat revised version of) Greg Mullane's patch to eliminate
heuristic determination of day vs month in date/time input.  Add the
ability to specify that input is interpreted as yy-mm-dd order (which
formerly worked, but only for yy greater than 31).  DateStyle's input
component now has the preferred spellings DMY, MDY, or YMD; the older
keywords European and US are now aliases for the first two of these.
Per recent discussions on pgsql-general.
2003-07-29 00:03:19 +00:00
Peter Eisentraut a8cb3368db General editing 2003-04-07 01:29:26 +00:00
Peter Eisentraut 706a32cdf6 Big editing for consistent content and presentation. 2003-03-13 01:30:29 +00:00
Peter Eisentraut 1b342df00a Merge documentation updates from 7.3 branch. 2002-11-11 20:14:04 +00:00
Thomas G. Lockhart 6045f39bfd Add Myannar Time, Iran Time variant name, and Marquesas Time. 2002-08-04 06:15:45 +00:00
Peter Eisentraut b6ea172ace Spell checking and markup additions 2002-03-22 19:20:45 +00:00
Peter Eisentraut bf43bed848 Spell-check and markup police 2002-01-20 22:19:57 +00:00
Thomas G. Lockhart c5c28ed06a Add more complete details on date/time keywords and parsing rules.
Move some tabular information on these from the chapter on data types to
 the appendix on dates and times.
2002-01-04 17:02:25 +00:00
Thomas G. Lockhart dd0279b1ba Document the precision arguments for date/time types per SQL9x.
Update the list of recognized time zones.
Document the range of arguments allowed for SET TIME ZONE.
Still need to add info on other date/time symbols (e.g. "AM", "T")
 and to freshen the docs on the date/time parsing rules.
2001-12-29 18:35:54 +00:00
Thomas G. Lockhart 2475e87481 Deprecate 'current' for date/time input.
Fix up references to "PostgreSQL" rather than "Postgres". Was roughly
 evenly split between the two before. ref/ files not yet done.
2001-11-21 05:53:41 +00:00
Thomas G. Lockhart f9681968e0 Add information on new timestamp and timestamptz data types.
Start chapter on recovery techniques. Still needs work for release.
2001-09-28 08:15:35 +00:00
Peter Eisentraut 351a0c1736 Replace ASCII-quotes with proper markup. 2001-09-13 15:55:24 +00:00
Peter Eisentraut 84956e71a3 Markup additions and spell check. (covers User's Guide) 2001-09-09 17:21:59 +00:00
Tom Lane ec96f1dacd Fix some references to USE_AUSTRALIAN_RULES that Bruce missed;
plus a few trivial improvements in wording.
2001-06-18 19:05:11 +00:00
Peter Eisentraut 01839df6dd Add index. Only some parts of the manual set have index entries so far... 2001-05-12 22:51:36 +00:00
Bruce Momjian 8824741f99 User Manual
Chapter 4
   String Operators
    Table 4.7: Other String Functions
      strpos is missing the result in the result column, it should be 2
      Also to_ascii might need a result but maybe not.

Appendix A
In the Time Zone Table
 Greenwich is spelled Greenwish

David Aldrich
2001-02-12 14:21:27 +00:00