PostgreSQL 9.4.1 Documentation | |||
---|---|---|---|
Prev | Up | Appendix B. Date/Time Support | Next |
B.3. Date/Time Configuration Files
Since timezone abbreviations are not well standardized, PostgreSQL provides a means to customize the set of abbreviations accepted by the server. The timezone_abbreviations run-time parameter determines the active set of abbreviations. While this parameter can be altered by any database user, the possible values for it are under the control of the database administrator — they are in fact names of configuration files stored in .../share/timezonesets/ of the installation directory. By adding or altering files in that directory, the administrator can set local policy for timezone abbreviations.
timezone_abbreviations can be set to any file name found in .../share/timezonesets/, if the file's name is entirely alphabetic. (The prohibition against non-alphabetic characters in timezone_abbreviations prevents reading files outside the intended directory, as well as reading editor backup files and other extraneous files.)
A timezone abbreviation file can contain blank lines and comments beginning with #. Non-comment lines must have one of these formats:
zone_abbreviation offset zone_abbreviation offset D zone_abbreviation time_zone_name @INCLUDE file_name @OVERRIDE
A zone_abbreviation is just the abbreviation being defined. The offset is the equivalent offset in seconds from UTC, positive being east from Greenwich and negative being west. For example, -18000 would be five hours west of Greenwich, or North American east coast standard time. D indicates that the zone name represents local daylight-savings time rather than standard time. Alternatively, a time_zone_name can be given, in which case that time zone definition is consulted, and the abbreviation's meaning in that zone is used. This alternative is recommended only for abbreviations whose meaning has historically varied, as looking up the meaning is noticeably more expensive than just using a fixed integer value.
The @INCLUDE syntax allows inclusion of another file in the .../share/timezonesets/ directory. Inclusion can be nested, to a limited depth.
The @OVERRIDE syntax indicates that subsequent entries in the file can override previous entries (typically, entries obtained from included files). Without this, conflicting definitions of the same timezone abbreviation are considered an error.
In an unmodified installation, the file Default contains all the non-conflicting time zone abbreviations for most of the world. Additional files Australia and India are provided for those regions: these files first include the Default file and then add or modify abbreviations as needed.
For reference purposes, a standard installation also contains files Africa.txt, America.txt, etc, containing information about every time zone abbreviation known to be in use according to the IANA timezone database. The zone name definitions found in these files can be copied and pasted into a custom configuration file as needed. Note that these files cannot be directly referenced as timezone_abbreviations settings, because of the dot embedded in their names.
Note: If an error occurs while reading the time zone abbreviation set, no new value is applied and the old set is kept. If the error occurs while starting the database, startup fails.
Caution |
Time zone abbreviations defined in the configuration file override non-timezone meanings built into PostgreSQL. For example, the Australia configuration file defines SAT (for South Australian Standard Time). When this file is active, SAT will not be recognized as an abbreviation for Saturday. |
Caution |
If you modify files in .../share/timezonesets/, it is up to you to make backups — a normal database dump will not include this directory. |