1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.63 2001/09/13 15:55:22 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.64 2001/09/28 08: 15:35 thomas Exp $
3
3
-->
4
4
5
5
<chapter id="datatype">
@@ -229,13 +229,19 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.63 2001/09/13 15:55:22 pe
229
229
230
230
<row>
231
231
<entry><type>time with time zone</type></entry>
232
- <entry></entry>
232
+ <entry>timetz </entry>
233
233
<entry>time of day, including time zone</entry>
234
234
</row>
235
235
236
+ <row>
237
+ <entry><type>timestamp without time zone</type></entry>
238
+ <entry>timestamp</entry>
239
+ <entry>date and time</entry>
240
+ </row>
241
+
236
242
<row>
237
243
<entry><type>timestamp [ with time zone ]</type></entry>
238
- <entry></entry>
244
+ <entry>timestamptz </entry>
239
245
<entry>date and time</entry>
240
246
</row>
241
247
</tbody>
@@ -981,7 +987,7 @@ SELECT b, char_length(b) FROM test2;
981
987
</thead>
982
988
<tbody>
983
989
<row>
984
- <entry><type>timestamp</type></entry>
990
+ <entry><type>timestamp without time zone </type></entry>
985
991
<entry>both date and time</entry>
986
992
<entry>8 bytes</entry>
987
993
<entry>4713 BC</entry>
@@ -990,10 +996,10 @@ SELECT b, char_length(b) FROM test2;
990
996
</row>
991
997
<row>
992
998
<entry><type>timestamp [ with time zone ]</type></entry>
993
- <entry>date and time with time zone </entry>
999
+ <entry>both date and time</entry>
994
1000
<entry>8 bytes</entry>
995
- <entry>1903 AD </entry>
996
- <entry>2037 AD </entry>
1001
+ <entry>4713 BC </entry>
1002
+ <entry>AD 1465001 </entry>
997
1003
<entry>1 microsecond / 14 digits</entry>
998
1004
</row>
999
1005
<row>
@@ -1034,21 +1040,37 @@ SELECT b, char_length(b) FROM test2;
1034
1040
1035
1041
<note>
1036
1042
<para>
1037
- To ensure compatibility to earlier versions of <productname>Postgres</productname>
1038
- we also continue to provide <type>datetime</type> (equivalent to <type>timestamp</type>) and
1039
- <type>timespan</type> (equivalent to <type>interval</type>),
1040
- however support for these is now restricted to having an
1041
- implicit translation to <type>timestamp</type> and
1042
- <type>interval</type>.
1043
- The types <type>abstime</type>
1044
- and <type>reltime</type> are lower precision types which are used internally.
1045
- You are discouraged from using any of these types in new
1046
- applications and are encouraged to move any old
1047
- ones over when appropriate. Any or all of these internal types might disappear in a future release.
1043
+ Time zones, and time zone conventions, are influenced by
1044
+ political conventions, not just physical effects. Time zones have
1045
+ become somewhat standardized during the 1900's, but continue to
1046
+ be prone to arbitrary changes with time.
1047
+ <productname>PostgreSQL</productname> uses your operating
1048
+ system's underlying features to provide time zone
1049
+ support, and these systems usually contain information for only
1050
+ the time period 1902 through 2038 (corresponding to the full
1051
+ range of conventional Unix system time).
1052
+ <type>timestamp with time zone</type> will use time zone
1053
+ information only within that year range, and assumes that times
1054
+ are in UTC outside that range.
1048
1055
</para>
1049
1056
</note>
1050
1057
</para>
1051
1058
1059
+ <para>
1060
+ To ensure compatibility to earlier versions of <productname>Postgres</productname>
1061
+ we also continue to provide <type>datetime</type>
1062
+ (equivalent to <type>timestamp</type>) and
1063
+ <type>timespan</type> (equivalent to <type>interval</type>),
1064
+ however support for these is now restricted to having an
1065
+ implicit translation to <type>timestamp</type> and
1066
+ <type>interval</type>.
1067
+ The types <type>abstime</type>
1068
+ and <type>reltime</type> are lower precision types which are used internally.
1069
+ You are discouraged from using any of these types in new
1070
+ applications and are encouraged to move any old
1071
+ ones over when appropriate. Any or all of these internal types
1072
+ might disappear in a future release.
1073
+ </para>
1052
1074
1053
1075
<sect2 id="datatype-datetime-input">
1054
1076
<title>Date/Time Input</title>
@@ -1266,6 +1288,10 @@ SELECT b, char_length(b) FROM test2;
1266
1288
<primary>time</primary>
1267
1289
<secondary>data type</secondary>
1268
1290
</indexterm>
1291
+ <indexterm>
1292
+ <primary>time without time zone</primary>
1293
+ <secondary>time</secondary>
1294
+ </indexterm>
1269
1295
1270
1296
<para>
1271
1297
Per SQL99, this type can be referenced as <type>time</type> and
@@ -1330,11 +1356,21 @@ SELECT b, char_length(b) FROM test2;
1330
1356
<sect3>
1331
1357
<title><type>time with time zone</type></title>
1332
1358
1359
+ <indexterm>
1360
+ <primary>time with time zone</primary>
1361
+ <secondary>data type</secondary>
1362
+ </indexterm>
1363
+ <indexterm>
1364
+ <primary>time</primary>
1365
+ <secondary>data type</secondary>
1366
+ </indexterm>
1367
+
1333
1368
<para>
1334
1369
This type is defined by SQL92, but the definition exhibits
1335
- fundamental deficiencies that render the type nearly useless . In
1370
+ properties which lead to questionable usefulness . In
1336
1371
most cases, a combination of <type>date</type>,
1337
- <type>time</type>, and <type>timestamp</type>
1372
+ <type>time</type>, <type>timestamp without time zone</type>
1373
+ and <type>timestamp with time zone</type>
1338
1374
should provide a complete range of date/time functionality
1339
1375
required by any application.
1340
1376
</para>
@@ -1382,7 +1418,44 @@ SELECT b, char_length(b) FROM test2;
1382
1418
</sect3>
1383
1419
1384
1420
<sect3>
1385
- <title><type>timestamp</type></title>
1421
+ <title><type>timestamp without time zone</type></title>
1422
+
1423
+ <indexterm>
1424
+ <primary>timestamp without time zone</primary>
1425
+ <secondary>data type</secondary>
1426
+ </indexterm>
1427
+
1428
+ <para>
1429
+ Valid input for the <type>timestamp without time zone</type>
1430
+ type consists of a concatenation
1431
+ of a date and a time, followed by an optional <literal>AD</literal> or
1432
+ <literal>BC</literal>, followed by an optional time zone. (See below.)
1433
+ Thus
1434
+
1435
+ <programlisting>
1436
+ 1999-01-08 04:05:06
1437
+ </programlisting>
1438
+
1439
+ is a valid <type>timestamp without time zone</type> value that
1440
+ is <acronym>ISO</acronym>-compliant.
1441
+ In addition, the wide-spread format
1442
+
1443
+ <programlisting>
1444
+ January 8 04:05:06 1999 PST
1445
+ </programlisting>
1446
+ is supported.
1447
+ </para>
1448
+
1449
+ <para>
1450
+ For <type>timestamp without time zone</type>, any explicit time
1451
+ zone specified in the input is silently swallowed. That is, the
1452
+ resulting date/time value is derived from the explicit date/time
1453
+ fields in the input value, and is not adjusted for time zone.
1454
+ </para>
1455
+ </sect3>
1456
+
1457
+ <sect3>
1458
+ <title><type>timestamp with time zone</type></title>
1386
1459
1387
1460
<indexterm>
1388
1461
<primary>timestamp</primary>
@@ -1500,10 +1573,12 @@ January 8 04:05:06 1999 PST
1500
1573
</row>
1501
1574
</thead>
1502
1575
<tbody>
1576
+ <!--
1503
1577
<row>
1504
1578
<entry>current</entry>
1505
1579
<entry>Current transaction time, deferred</entry>
1506
1580
</row>
1581
+ -->
1507
1582
<row>
1508
1583
<entry>epoch</entry>
1509
1584
<entry>1970-01-01 00:00:00+00 (Unix system time zero)</entry>
0 commit comments