gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 line
8.5KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>B.4. Date/Time Configuration Files</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="datetime-keywords.html" title="B.3. Date/Time Key Words" /><link rel="next" href="datetime-posix-timezone-specs.html" title="B.5. POSIX Time Zone Specifications" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">B.4. Date/Time Configuration Files</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="datetime-keywords.html" title="B.3. Date/Time Key Words">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="datetime-appendix.html" title="Appendix B. Date/Time Support">Up</a></td><th width="60%" align="center">Appendix B. Date/Time Support</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="datetime-posix-timezone-specs.html" title="B.5. POSIX Time Zone Specifications">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="DATETIME-CONFIG-FILES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">B.4. Date/Time Configuration Files</h2></div></div></div><a id="id-1.11.3.7.2" class="indexterm"></a><p>
  3. Since timezone abbreviations are not well standardized,
  4. <span class="productname">PostgreSQL</span> provides a means to customize
  5. the set of abbreviations accepted by the server. The
  6. <a class="xref" href="runtime-config-client.html#GUC-TIMEZONE-ABBREVIATIONS">timezone_abbreviations</a> run-time parameter
  7. determines the active set of abbreviations. While this parameter
  8. can be altered by any database user, the possible values for it
  9. are under the control of the database administrator — they
  10. are in fact names of configuration files stored in
  11. <code class="filename">.../share/timezonesets/</code> of the installation directory.
  12. By adding or altering files in that directory, the administrator
  13. can set local policy for timezone abbreviations.
  14. </p><p>
  15. <code class="varname">timezone_abbreviations</code> can be set to any file name
  16. found in <code class="filename">.../share/timezonesets/</code>, if the file's name
  17. is entirely alphabetic. (The prohibition against non-alphabetic
  18. characters in <code class="varname">timezone_abbreviations</code> prevents reading
  19. files outside the intended directory, as well as reading editor
  20. backup files and other extraneous files.)
  21. </p><p>
  22. A timezone abbreviation file can contain blank lines and comments
  23. beginning with <code class="literal">#</code>. Non-comment lines must have one of
  24. these formats:
  25. </p><pre class="synopsis">
  26. <em class="replaceable"><code>zone_abbreviation</code></em> <em class="replaceable"><code>offset</code></em>
  27. <em class="replaceable"><code>zone_abbreviation</code></em> <em class="replaceable"><code>offset</code></em> D
  28. <em class="replaceable"><code>zone_abbreviation</code></em> <em class="replaceable"><code>time_zone_name</code></em>
  29. @INCLUDE <em class="replaceable"><code>file_name</code></em>
  30. @OVERRIDE
  31. </pre><p>
  32. </p><p>
  33. A <em class="replaceable"><code>zone_abbreviation</code></em> is just the abbreviation
  34. being defined. An <em class="replaceable"><code>offset</code></em> is an integer giving
  35. the equivalent offset in seconds from UTC, positive being east from
  36. Greenwich and negative being west. For example, -18000 would be five
  37. hours west of Greenwich, or North American east coast standard time.
  38. <code class="literal">D</code> indicates that the zone name represents local
  39. daylight-savings time rather than standard time.
  40. </p><p>
  41. Alternatively, a <em class="replaceable"><code>time_zone_name</code></em> can be given, referencing
  42. a zone name defined in the IANA timezone database. The zone's definition
  43. is consulted to see whether the abbreviation is or has been in use in
  44. that zone, and if so, the appropriate meaning is used — that is,
  45. the meaning that was currently in use at the timestamp whose value is
  46. being determined, or the meaning in use immediately before that if it
  47. wasn't current at that time, or the oldest meaning if it was used only
  48. after that time. This behavior is essential for dealing with
  49. abbreviations whose meaning has historically varied. It is also allowed
  50. to define an abbreviation in terms of a zone name in which that
  51. abbreviation does not appear; then using the abbreviation is just
  52. equivalent to writing out the zone name.
  53. </p><div class="tip"><h3 class="title">Tip</h3><p>
  54. Using a simple integer <em class="replaceable"><code>offset</code></em> is preferred
  55. when defining an abbreviation whose offset from UTC has never changed,
  56. as such abbreviations are much cheaper to process than those that
  57. require consulting a time zone definition.
  58. </p></div><p>
  59. The <code class="literal">@INCLUDE</code> syntax allows inclusion of another file in the
  60. <code class="filename">.../share/timezonesets/</code> directory. Inclusion can be nested,
  61. to a limited depth.
  62. </p><p>
  63. The <code class="literal">@OVERRIDE</code> syntax indicates that subsequent entries in the
  64. file can override previous entries (typically, entries obtained from
  65. included files). Without this, conflicting definitions of the same
  66. timezone abbreviation are considered an error.
  67. </p><p>
  68. In an unmodified installation, the file <code class="filename">Default</code> contains
  69. all the non-conflicting time zone abbreviations for most of the world.
  70. Additional files <code class="filename">Australia</code> and <code class="filename">India</code> are
  71. provided for those regions: these files first include the
  72. <code class="literal">Default</code> file and then add or modify abbreviations as needed.
  73. </p><p>
  74. For reference purposes, a standard installation also contains files
  75. <code class="filename">Africa.txt</code>, <code class="filename">America.txt</code>, etc, containing
  76. information about every time zone abbreviation known to be in use
  77. according to the IANA timezone database. The zone name
  78. definitions found in these files can be copied and pasted into a custom
  79. configuration file as needed. Note that these files cannot be directly
  80. referenced as <code class="varname">timezone_abbreviations</code> settings, because of
  81. the dot embedded in their names.
  82. </p><div class="note"><h3 class="title">Note</h3><p>
  83. If an error occurs while reading the time zone abbreviation set, no new
  84. value is applied and the old set is kept. If the error occurs while
  85. starting the database, startup fails.
  86. </p></div><div class="caution"><h3 class="title">Caution</h3><p>
  87. Time zone abbreviations defined in the configuration file override
  88. non-timezone meanings built into <span class="productname">PostgreSQL</span>.
  89. For example, the <code class="filename">Australia</code> configuration file defines
  90. <code class="literal">SAT</code> (for South Australian Standard Time). When this
  91. file is active, <code class="literal">SAT</code> will not be recognized as an abbreviation
  92. for Saturday.
  93. </p></div><div class="caution"><h3 class="title">Caution</h3><p>
  94. If you modify files in <code class="filename">.../share/timezonesets/</code>,
  95. it is up to you to make backups — a normal database dump
  96. will not include this directory.
  97. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="datetime-keywords.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="datetime-appendix.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="datetime-posix-timezone-specs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">B.3. Date/Time Key Words </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> B.5. <acronym class="acronym">POSIX</acronym> Time Zone Specifications</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1