|
1 | | -<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.175 2006/09/16 16:18:11 tgl Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.176 2006/09/22 16:20:00 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="datatype"> |
4 | 4 | <title id="datatype-title">Data Types</title> |
@@ -1706,8 +1706,8 @@ SELECT b, char_length(b) FROM test2; |
1706 | 1706 | </table> |
1707 | 1707 |
|
1708 | 1708 | <para> |
1709 | | - Refer to <xref linkend="datetime-appendix"> fora list of |
1710 | | -time zone names that are recognized for input. |
| 1709 | + Refer to <xref linkend="datatype-timezones"> formore information on how |
| 1710 | +to specify time zones. |
1711 | 1711 | </para> |
1712 | 1712 | </sect3> |
1713 | 1713 |
|
@@ -2151,6 +2151,83 @@ January 8 04:05:06 1999 PST |
2151 | 2151 | parameter before being displayed to the client. |
2152 | 2152 | </para> |
2153 | 2153 |
|
| 2154 | + <para> |
| 2155 | + <productname>PostgreSQL</productname> allows you to specify time zones in |
| 2156 | + three different forms: |
| 2157 | + <itemizedlist> |
| 2158 | + <listitem> |
| 2159 | + <para> |
| 2160 | + A full time zone name, for example <literal>America/New_York</>. |
| 2161 | + The recognized time zone names are listed in the |
| 2162 | + <literal>pg_timezone_names</literal> view (see <xref |
| 2163 | + linkend="view-pg-timezone-names">). |
| 2164 | + <productname>PostgreSQL</productname> uses the widely-used |
| 2165 | + <literal>zic</> time zone data for this purpose, so the same |
| 2166 | + names are also recognized by much other software. |
| 2167 | + </para> |
| 2168 | + </listitem> |
| 2169 | + <listitem> |
| 2170 | + <para> |
| 2171 | + A time zone abbreviation, for example <literal>PST</>. Such a |
| 2172 | + specification merely defines a particular offset from UTC, in |
| 2173 | + contrast to full time zone names which may imply a set of daylight |
| 2174 | + savings transition-date rules as well. The recognized abbreviations |
| 2175 | + are listed in the <literal>pg_timezone_abbrevs</> view (see <xref |
| 2176 | + linkend="view-pg-timezone-abbrevs">). You cannot set the |
| 2177 | + configuration parameter <xref linkend="guc-timezone"> using a time |
| 2178 | + zone abbreviation, but you can use abbreviations in |
| 2179 | + date/time input values and with the <literal>AT TIME ZONE</> |
| 2180 | + operator. |
| 2181 | + </para> |
| 2182 | + </listitem> |
| 2183 | + <listitem> |
| 2184 | + <para> |
| 2185 | + In addition to the timezone names and abbreviations, |
| 2186 | + <productname>PostgreSQL</productname> will accept time zone |
| 2187 | + specifications of the form <replaceable>STD</><replaceable>offset</> or |
| 2188 | + <replaceable>STD</><replaceable>offset</><replaceable>DST</>, where |
| 2189 | + <replaceable>STD</> is a zone abbreviation, <replaceable>offset</> is a |
| 2190 | + numeric offset in hours west from UTC, and <replaceable>DST</> is an |
| 2191 | + optional daylight-savings zone abbreviation, assumed to stand for one |
| 2192 | + hour ahead of the given offset. For example, if <literal>EST5EDT</> |
| 2193 | + were not already a recognized zone name, it would be accepted and would |
| 2194 | + be functionally equivalent to USA East Coast time. When a |
| 2195 | + daylight-savings zone name is present, it is assumed to be used |
| 2196 | + according to USA time zone rules, so this feature is of limited use |
| 2197 | + outside North America. One should also be wary that this provision can |
| 2198 | + lead to silently accepting bogus input, since there is no check on the |
| 2199 | + reasonableness of the zone abbreviations. For example, <literal>SET |
| 2200 | + TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using |
| 2201 | + a rather peculiar abbreviation for GMT. |
| 2202 | + </para> |
| 2203 | + </listitem> |
| 2204 | + </itemizedlist> |
| 2205 | + |
| 2206 | + There is a conceptual and practical difference between the abbreviations |
| 2207 | + and the full names: abbreviations always represent a fixed offset from |
| 2208 | + UTC, whereas most of the full names imply a local daylight-savings time |
| 2209 | + rule and so have two possible UTC offsets. That's why you always have to |
| 2210 | + specify a date if you want to use full time zone names in <type>timetz</> |
| 2211 | + values. This is also the reason why you should set <xref |
| 2212 | + linkend="guc-timezone"> to a full time zone name: this way, |
| 2213 | + <productname>PostgreSQL</productname> |
| 2214 | + will always know the correct UTC offset for your region. |
| 2215 | + </para> |
| 2216 | + |
| 2217 | + <para> |
| 2218 | + Note that timezone names are <emphasis>not</> used for date/time output |
| 2219 | + — all supported output formats use numeric timezone displays to |
| 2220 | + avoid ambiguity. |
| 2221 | + </para> |
| 2222 | + |
| 2223 | + <para> |
| 2224 | + Neither full names nor abbreviations are hard-wired into the server; |
| 2225 | + they are obtained from configuration files stored under |
| 2226 | + <filename>.../share/timezone/</> and <filename>.../share/timezonesets/</> |
| 2227 | + of the installation directory |
| 2228 | + (see <xref linkend="datetime-config-files">). |
| 2229 | + </para> |
| 2230 | + |
2154 | 2231 | <para> |
2155 | 2232 | The <xref linkend="guc-timezone"> configuration parameter can |
2156 | 2233 | be set in the file <filename>postgresql.conf</>, or in any of the |
@@ -2191,12 +2268,6 @@ January 8 04:05:06 1999 PST |
2191 | 2268 | </listitem> |
2192 | 2269 | </itemizedlist> |
2193 | 2270 | </para> |
2194 | | - |
2195 | | - <para> |
2196 | | - Refer to <xref linkend="datetime-appendix"> for a list of |
2197 | | - available time zones. |
2198 | | - </para> |
2199 | | - |
2200 | 2271 | </sect2> |
2201 | 2272 |
|
2202 | 2273 | <sect2 id="datatype-datetime-internals"> |
@@ -3424,10 +3495,9 @@ SELECT * FROM pg_attribute |
3424 | 3495 | <listitem> |
3425 | 3496 |
|
3426 | 3497 | <para> |
3427 | | -Missing features include XQuery, SQL/XML syntax (ISO/IEC |
3428 | | -9075-14), and an <acronym>XML</> data type optimized for |
3429 | | -<acronym>XML</> storage. |
3430 | | - |
| 3498 | + Missing features include XQuery, SQL/XML syntax (ISO/IEC |
| 3499 | + 9075-14), and an <acronym>XML</> data type optimized for |
| 3500 | + <acronym>XML</> storage. |
3431 | 3501 | </para> |
3432 | 3502 | </listitem> |
3433 | 3503 | </varlistentry> |
|