Commit a77275fe authored by Bruce Momjian's avatar Bruce Momjian

Please find attached two patches for documentation and regression tests

for the usage of full time zone names.

Joachim Wieland
parent 956cbeb7
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.168 2006/06/18 15:38:35 petere Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.169 2006/07/06 01:46:37 momjian Exp $ -->
<chapter id="datatype"> <chapter id="datatype">
<title id="datatype-title">Data Types</title> <title id="datatype-title">Data Types</title>
...@@ -1602,7 +1602,12 @@ SELECT b, char_length(b) FROM test2; ...@@ -1602,7 +1602,12 @@ SELECT b, char_length(b) FROM test2;
linkend="datatype-datetime-time-table"> linkend="datatype-datetime-time-table">
and <xref linkend="datatype-timezone-table">.) If a time zone is and <xref linkend="datatype-timezone-table">.) If a time zone is
specified in the input for <type>time without time zone</type>, specified in the input for <type>time without time zone</type>,
it is silently ignored. it is silently ignored. You can also always specify a date but it will
be ignored except for when you use a full time zone name like
<literal>America/New_York</literal>. In this case specifying the date
is compulsory in order to tell which time zone offset should be
applied. It will be applied whatever time zone offset was valid at that
date and time at the specified place.
</para> </para>
<table id="datatype-datetime-time-table"> <table id="datatype-datetime-time-table">
...@@ -1659,6 +1664,10 @@ SELECT b, char_length(b) FROM test2; ...@@ -1659,6 +1664,10 @@ SELECT b, char_length(b) FROM test2;
<entry><literal>04:05:06 PST</literal></entry> <entry><literal>04:05:06 PST</literal></entry>
<entry>time zone specified by name</entry> <entry>time zone specified by name</entry>
</row> </row>
<row>
<entry><literal>2003-04-12 04:05:06 America/New_York</literal></entry>
<entry>time zone specified by full name</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -1677,6 +1686,10 @@ SELECT b, char_length(b) FROM test2; ...@@ -1677,6 +1686,10 @@ SELECT b, char_length(b) FROM test2;
<entry><literal>PST</literal></entry> <entry><literal>PST</literal></entry>
<entry>Pacific Standard Time</entry> <entry>Pacific Standard Time</entry>
</row> </row>
<row>
<entry><literal>America/New_York</literal></entry>
<entry>Full time zone name</entry>
</row>
<row> <row>
<entry><literal>-8:00</literal></entry> <entry><literal>-8:00</literal></entry>
<entry>ISO-8601 offset for PST</entry> <entry>ISO-8601 offset for PST</entry>
...@@ -1739,8 +1752,12 @@ SELECT b, char_length(b) FROM test2; ...@@ -1739,8 +1752,12 @@ SELECT b, char_length(b) FROM test2;
</programlisting> </programlisting>
are valid values, which follow the <acronym>ISO</acronym> 8601 are valid values, which follow the <acronym>ISO</acronym> 8601
standard. In addition, the wide-spread format standard. You can also specify the full time zone name as in
<programlisting>
1999-01-08 04:05:06 America/New_York
</programlisting>
In addition, the wide-spread format
<programlisting> <programlisting>
January 8 04:05:06 1999 PST January 8 04:05:06 1999 PST
</programlisting> </programlisting>
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.49 2006/04/23 03:39:50 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.50 2006/07/06 01:46:37 momjian Exp $ -->
<appendix id="datetime-appendix"> <appendix id="datetime-appendix">
<title>Date/Time Support</title> <title>Date/Time Support</title>
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
<para> <para>
If the numeric token contains a dash (<literal>-</>), slash If the numeric token contains a dash (<literal>-</>), slash
(<literal>/</>), or two or more dots (<literal>.</>), this is (<literal>/</>), or two or more dots (<literal>.</>), this is
a date string which may have a text month. a date string which may have a text month. In case of a slash
(<literal>/</>) it can also be a full time zone name like
<literal>America/New_York</>.
</para> </para>
</step> </step>
...@@ -359,7 +361,8 @@ ...@@ -359,7 +361,8 @@
</indexterm> </indexterm>
<para> <para>
<xref linkend="datetime-timezone-input-table"> shows the time zone <xref linkend="datetime-timezone-input-table"> and
<xref linkend="datetime-timezone-full-names-table"> show the time zone
abbreviations recognized by <productname>PostgreSQL</productname> abbreviations recognized by <productname>PostgreSQL</productname>
in date/time input values. Note that these names are <emphasis>not</> in date/time input values. Note that these names are <emphasis>not</>
necessarily used for date/time output &mdash; output is driven by the necessarily used for date/time output &mdash; output is driven by the
...@@ -983,13 +986,15 @@ ...@@ -983,13 +986,15 @@
</indexterm> </indexterm>
<para> <para>
<xref linkend="datetime-timezone-set-table"> shows the time zone <xref linkend="datetime-timezone-full-names-table"> shows the time zone
names recognized by <productname>PostgreSQL</productname> as valid names recognized by <productname>PostgreSQL</productname> as valid
settings for the <xref linkend="guc-timezone"> parameter. Note that settings for the <xref linkend="guc-timezone"> parameter. Note that
these names are conceptually as well as practically different from these names are conceptually as well as practically different from
the names shown in <xref linkend="datetime-timezone-input-table">: the names shown in <xref linkend="datetime-timezone-input-table">:
most of these names imply a local daylight-savings time rule, whereas most of these names imply a local daylight-savings time rule, whereas
the former names each represent just a fixed offset from UTC. the former names each represent just a fixed offset from UTC. That's why
you always have to specify a date if you want to use these time zone
names in <type>timetz</> values.
</para> </para>
<para> <para>
...@@ -998,8 +1003,8 @@ ...@@ -998,8 +1003,8 @@
by the name of the principal city of the zone. by the name of the principal city of the zone.
</para> </para>
<table id="datetime-timezone-set-table"> <table id="datetime-timezone-full-names-table">
<title>Time Zone Names for Setting <varname>timezone</></title> <title>Time Zone Names for date/time input values and for setting <varname>timezone</></title>
<tgroup cols="1"> <tgroup cols="1">
<thead> <thead>
<row> <row>
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.323 2006/06/19 16:13:01 tgl Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.324 2006/07/06 01:46:37 momjian Exp $ -->
<chapter id="functions"> <chapter id="functions">
<title>Functions and Operators</title> <title>Functions and Operators</title>
...@@ -6099,7 +6099,7 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40'); ...@@ -6099,7 +6099,7 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
specified either as a text string (e.g., <literal>'PST'</literal>) specified either as a text string (e.g., <literal>'PST'</literal>)
or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>). or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>).
In the text case, the available zone names are those shown in either In the text case, the available zone names are those shown in either
<xref linkend="datetime-timezone-set-table"> or <xref linkend="datetime-timezone-full-names-table"> or
<xref linkend="datetime-timezone-input-table">. <xref linkend="datetime-timezone-input-table">.
</para> </para>
......
...@@ -450,6 +450,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; ...@@ -450,6 +450,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998
| Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998
| Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998
| Tue Feb 10 14:32:01 1998
| Wed Jun 10 18:32:01 1998 | Wed Jun 10 18:32:01 1998
| Tue Feb 10 17:32:01 1998 | Tue Feb 10 17:32:01 1998
| Wed Feb 11 17:32:01 1998 | Wed Feb 11 17:32:01 1998
...@@ -481,7 +482,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; ...@@ -481,7 +482,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Mon Jan 01 17:32:01 2001 | Mon Jan 01 17:32:01 2001
| Mon Dec 31 17:32:01 2001 | Mon Dec 31 17:32:01 2001
| Tue Jan 01 17:32:01 2002 | Tue Jan 01 17:32:01 2002
(64 rows) (65 rows)
SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
64 | one_year 64 | one_year
...@@ -519,6 +520,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; ...@@ -519,6 +520,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996
| Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996
| Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996
| Sat Feb 10 14:32:01 1996
| Mon Jun 10 18:32:01 1996 | Mon Jun 10 18:32:01 1996
| Sat Feb 10 17:32:01 1996 | Sat Feb 10 17:32:01 1996
| Sun Feb 11 17:32:01 1996 | Sun Feb 11 17:32:01 1996
...@@ -550,7 +552,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; ...@@ -550,7 +552,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Fri Jan 01 17:32:01 1999 | Fri Jan 01 17:32:01 1999
| Fri Dec 31 17:32:01 1999 | Fri Dec 31 17:32:01 1999
| Sat Jan 01 17:32:01 2000 | Sat Jan 01 17:32:01 2000
(64 rows) (65 rows)
SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29"; SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29";
Feb 29 Feb 29
...@@ -693,6 +695,8 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; ...@@ -693,6 +695,8 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Tue Feb 10 09:32:01 1998 PST | Tue Feb 10 09:32:01 1998 PST
| Tue Feb 10 09:32:01 1998 PST | Tue Feb 10 09:32:01 1998 PST
| Tue Feb 10 09:32:01 1998 PST | Tue Feb 10 09:32:01 1998 PST
| Tue Feb 10 14:32:01 1998 PST
| Fri Jul 10 14:32:01 1998 PDT
| Wed Jun 10 18:32:01 1998 PDT | Wed Jun 10 18:32:01 1998 PDT
| Tue Feb 10 17:32:01 1998 PST | Tue Feb 10 17:32:01 1998 PST
| Wed Feb 11 17:32:01 1998 PST | Wed Feb 11 17:32:01 1998 PST
...@@ -724,7 +728,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; ...@@ -724,7 +728,7 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST
| Mon Dec 31 17:32:01 2001 PST | Mon Dec 31 17:32:01 2001 PST
| Tue Jan 01 17:32:01 2002 PST | Tue Jan 01 17:32:01 2002 PST
(64 rows) (66 rows)
SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
64 | one_year 64 | one_year
...@@ -762,6 +766,8 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; ...@@ -762,6 +766,8 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Sat Feb 10 09:32:01 1996 PST | Sat Feb 10 09:32:01 1996 PST
| Sat Feb 10 09:32:01 1996 PST | Sat Feb 10 09:32:01 1996 PST
| Sat Feb 10 09:32:01 1996 PST | Sat Feb 10 09:32:01 1996 PST
| Sat Feb 10 14:32:01 1996 PST
| Wed Jul 10 14:32:01 1996 PDT
| Mon Jun 10 18:32:01 1996 PDT | Mon Jun 10 18:32:01 1996 PDT
| Sat Feb 10 17:32:01 1996 PST | Sat Feb 10 17:32:01 1996 PST
| Sun Feb 11 17:32:01 1996 PST | Sun Feb 11 17:32:01 1996 PST
...@@ -793,7 +799,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; ...@@ -793,7 +799,7 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Fri Jan 01 17:32:01 1999 PST | Fri Jan 01 17:32:01 1999 PST
| Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST
| Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST
(64 rows) (66 rows)
-- --
-- time, interval arithmetic -- time, interval arithmetic
...@@ -932,6 +938,8 @@ SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i ...@@ -932,6 +938,8 @@ SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
Mon Feb 10 22:32:01 1997 Mon Feb 10 22:32:01 1997
Mon Feb 10 17:33:01 1997 Mon Feb 10 17:33:01 1997
Mon Feb 10 22:32:01 1997 Mon Feb 10 22:32:01 1997
Mon Feb 10 14:33:01 1997
Mon Feb 10 19:32:01 1997
Tue Jun 10 18:33:01 1997 Tue Jun 10 18:33:01 1997
Tue Jun 10 23:32:01 1997 Tue Jun 10 23:32:01 1997
Mon Feb 10 17:33:01 1997 Mon Feb 10 17:33:01 1997
...@@ -976,7 +984,7 @@ SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i ...@@ -976,7 +984,7 @@ SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
Sat Jan 01 22:32:01 2000 Sat Jan 01 22:32:01 2000
Sun Dec 31 17:33:01 2000 Sun Dec 31 17:33:01 2000
Sun Dec 31 22:32:01 2000 Sun Dec 31 22:32:01 2000
(102 rows) (104 rows)
SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01' WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
...@@ -1041,6 +1049,8 @@ SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i ...@@ -1041,6 +1049,8 @@ SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
Mon Feb 10 12:32:01 1997 Mon Feb 10 12:32:01 1997
Mon Feb 10 17:31:01 1997 Mon Feb 10 17:31:01 1997
Mon Feb 10 12:32:01 1997 Mon Feb 10 12:32:01 1997
Mon Feb 10 14:31:01 1997
Mon Feb 10 09:32:01 1997
Tue Jun 10 18:31:01 1997 Tue Jun 10 18:31:01 1997
Tue Jun 10 13:32:01 1997 Tue Jun 10 13:32:01 1997
Mon Feb 10 17:31:01 1997 Mon Feb 10 17:31:01 1997
...@@ -1085,7 +1095,7 @@ SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i ...@@ -1085,7 +1095,7 @@ SELECT t.d1 - i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
Sat Jan 01 12:32:01 2000 Sat Jan 01 12:32:01 2000
Sun Dec 31 17:31:01 2000 Sun Dec 31 17:31:01 2000
Sun Dec 31 12:32:01 2000 Sun Dec 31 12:32:01 2000
(102 rows) (104 rows)
SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i; SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
80 80
...@@ -1170,7 +1180,27 @@ SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i; ...@@ -1170,7 +1180,27 @@ SELECT t.f1 + i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
23:59:59.99 23:59:59.99
23:59:59.99 23:59:59.99
11:59:59.99 11:59:59.99
(80 rows) 15:37:39
20:36:39
15:36:39
15:36:39
15:36:39
15:36:25
17:39:43
15:36:39
15:36:39
03:36:39
15:37:39
20:36:39
15:36:39
15:36:39
15:36:39
15:36:25
17:39:43
15:36:39
15:36:39
03:36:39
(100 rows)
SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i; SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
80 80
...@@ -1255,7 +1285,27 @@ SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i; ...@@ -1255,7 +1285,27 @@ SELECT t.f1 - i.f1 AS "80" FROM TIME_TBL t, INTERVAL_TBL i;
23:59:59.99 23:59:59.99
23:59:59.99 23:59:59.99
11:59:59.99 11:59:59.99
(80 rows) 15:35:39
10:36:39
15:36:39
15:36:39
15:36:39
15:36:53
13:33:35
15:36:39
15:36:39
03:36:39
15:35:39
10:36:39
15:36:39
15:36:39
15:36:39
15:36:53
13:33:35
15:36:39
15:36:39
03:36:39
(100 rows)
SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i; SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
100 100
...@@ -1360,7 +1410,27 @@ SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i; ...@@ -1360,7 +1410,27 @@ SELECT t.f1 + i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
23:59:59.99-07 23:59:59.99-07
23:59:59.99-07 23:59:59.99-07
11:59:59.99-07 11:59:59.99-07
(100 rows) 15:37:39-05
20:36:39-05
15:36:39-05
15:36:39-05
15:36:39-05
15:36:25-05
17:39:43-05
15:36:39-05
15:36:39-05
03:36:39-05
15:37:39-04
20:36:39-04
15:36:39-04
15:36:39-04
15:36:39-04
15:36:25-04
17:39:43-04
15:36:39-04
15:36:39-04
03:36:39-04
(120 rows)
SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i; SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
100 100
...@@ -1465,7 +1535,27 @@ SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i; ...@@ -1465,7 +1535,27 @@ SELECT t.f1 - i.f1 AS "100" FROM TIMETZ_TBL t, INTERVAL_TBL i;
23:59:59.99-07 23:59:59.99-07
23:59:59.99-07 23:59:59.99-07
11:59:59.99-07 11:59:59.99-07
(100 rows) 15:35:39-05
10:36:39-05
15:36:39-05
15:36:39-05
15:36:39-05
15:36:53-05
13:33:35-05
15:36:39-05
15:36:39-05
03:36:39-05
15:35:39-04
10:36:39-04
15:36:39-04
15:36:39-04
15:36:39-04
15:36:53-04
13:33:35-04
15:36:39-04
15:36:39-04
03:36:39-04
(120 rows)
-- SQL9x OVERLAPS operator -- SQL9x OVERLAPS operator
-- test with time zone -- test with time zone
...@@ -2450,6 +2540,7 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; ...@@ -2450,6 +2540,7 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
| Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997
| Mon Feb 10 14:32:01 1997
| Tue Jun 10 18:32:01 1997 | Tue Jun 10 18:32:01 1997
| Mon Feb 10 17:32:01 1997 | Mon Feb 10 17:32:01 1997
| Tue Feb 11 17:32:01 1997 | Tue Feb 11 17:32:01 1997
...@@ -2481,7 +2572,7 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; ...@@ -2481,7 +2572,7 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
| Sat Jan 01 17:32:01 2000 | Sat Jan 01 17:32:01 2000
| Sun Dec 31 17:32:01 2000 | Sun Dec 31 17:32:01 2000
| Mon Jan 01 17:32:01 2001 | Mon Jan 01 17:32:01 2001
(64 rows) (65 rows)
SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL;
seven | us_postgres seven | us_postgres
...@@ -2532,6 +2623,7 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; ...@@ -2532,6 +2623,7 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL;
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 14:32:01
| 1997-06-10 18:32:01 | 1997-06-10 18:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-11 17:32:01 | 1997-02-11 17:32:01
...@@ -2563,7 +2655,7 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; ...@@ -2563,7 +2655,7 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL;
| 2000-01-01 17:32:01 | 2000-01-01 17:32:01
| 2000-12-31 17:32:01 | 2000-12-31 17:32:01
| 2001-01-01 17:32:01 | 2001-01-01 17:32:01
(64 rows) (65 rows)
SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
seven | us_iso seven | us_iso
...@@ -2620,6 +2712,7 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; ...@@ -2620,6 +2712,7 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
| 02/10/1997 17:32:01 | 02/10/1997 17:32:01
| 02/10/1997 17:32:01 | 02/10/1997 17:32:01
| 02/10/1997 17:32:01 | 02/10/1997 17:32:01
| 02/10/1997 14:32:01
| 06/10/1997 18:32:01 | 06/10/1997 18:32:01
| 02/10/1997 17:32:01 | 02/10/1997 17:32:01
| 02/11/1997 17:32:01 | 02/11/1997 17:32:01
...@@ -2651,7 +2744,7 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; ...@@ -2651,7 +2744,7 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
| 01/01/2000 17:32:01 | 01/01/2000 17:32:01
| 12/31/2000 17:32:01 | 12/31/2000 17:32:01
| 01/01/2001 17:32:01 | 01/01/2001 17:32:01
(64 rows) (65 rows)
SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
seven | us_sql seven | us_sql
...@@ -2715,6 +2808,7 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; ...@@ -2715,6 +2808,7 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL;
| Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997
| Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997
| Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997
| Mon 10 Feb 14:32:01 1997
| Tue 10 Jun 18:32:01 1997 | Tue 10 Jun 18:32:01 1997
| Mon 10 Feb 17:32:01 1997 | Mon 10 Feb 17:32:01 1997
| Tue 11 Feb 17:32:01 1997 | Tue 11 Feb 17:32:01 1997
...@@ -2747,7 +2841,7 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; ...@@ -2747,7 +2841,7 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL;
| Sun 31 Dec 17:32:01 2000 | Sun 31 Dec 17:32:01 2000
| Mon 01 Jan 17:32:01 2001 | Mon 01 Jan 17:32:01 2001
| Thu 13 Jun 00:00:00 1957 | Thu 13 Jun 00:00:00 1957
(65 rows) (66 rows)
SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
seven | european_postgres seven | european_postgres
...@@ -2804,6 +2898,7 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; ...@@ -2804,6 +2898,7 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-10 14:32:01
| 1997-06-10 18:32:01 | 1997-06-10 18:32:01
| 1997-02-10 17:32:01 | 1997-02-10 17:32:01
| 1997-02-11 17:32:01 | 1997-02-11 17:32:01
...@@ -2836,7 +2931,7 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; ...@@ -2836,7 +2931,7 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
| 2000-12-31 17:32:01 | 2000-12-31 17:32:01
| 2001-01-01 17:32:01 | 2001-01-01 17:32:01
| 1957-06-13 00:00:00 | 1957-06-13 00:00:00
(65 rows) (66 rows)
SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
seven | european_iso seven | european_iso
...@@ -2893,6 +2988,7 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; ...@@ -2893,6 +2988,7 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
| 10/02/1997 17:32:01 | 10/02/1997 17:32:01
| 10/02/1997 17:32:01 | 10/02/1997 17:32:01
| 10/02/1997 17:32:01 | 10/02/1997 17:32:01
| 10/02/1997 14:32:01
| 10/06/1997 18:32:01 | 10/06/1997 18:32:01
| 10/02/1997 17:32:01 | 10/02/1997 17:32:01
| 11/02/1997 17:32:01 | 11/02/1997 17:32:01
...@@ -2925,7 +3021,7 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; ...@@ -2925,7 +3021,7 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
| 31/12/2000 17:32:01 | 31/12/2000 17:32:01
| 01/01/2001 17:32:01 | 01/01/2001 17:32:01
| 13/06/1957 00:00:00 | 13/06/1957 00:00:00
(65 rows) (66 rows)
SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL; SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL;
seven | european_sql seven | european_sql
......
...@@ -11,6 +11,11 @@ INSERT INTO TIME_TBL VALUES ('12:00'); ...@@ -11,6 +11,11 @@ INSERT INTO TIME_TBL VALUES ('12:00');
INSERT INTO TIME_TBL VALUES ('12:01'); INSERT INTO TIME_TBL VALUES ('12:01');
INSERT INTO TIME_TBL VALUES ('23:59'); INSERT INTO TIME_TBL VALUES ('23:59');
INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM'); INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM');
INSERT INTO TIME_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
-- this should fail (the timezone offset is not known)
INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York');
ERROR: invalid input syntax for type time: "15:36:39 America/New_York"
SELECT f1 AS "Time" FROM TIME_TBL; SELECT f1 AS "Time" FROM TIME_TBL;
Time Time
------------- -------------
...@@ -22,7 +27,9 @@ SELECT f1 AS "Time" FROM TIME_TBL; ...@@ -22,7 +27,9 @@ SELECT f1 AS "Time" FROM TIME_TBL;
12:01:00 12:01:00
23:59:00 23:59:00
23:59:59.99 23:59:59.99
(8 rows) 15:36:39
15:36:39
(10 rows)
SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07';
Three Three
...@@ -40,7 +47,9 @@ SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07'; ...@@ -40,7 +47,9 @@ SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07';
12:01:00 12:01:00
23:59:00 23:59:00
23:59:59.99 23:59:59.99
(5 rows) 15:36:39
15:36:39
(7 rows)
SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00'; SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00';
None None
...@@ -58,7 +67,9 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; ...@@ -58,7 +67,9 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00';
12:01:00 12:01:00
23:59:00 23:59:00
23:59:59.99 23:59:59.99
(8 rows) 15:36:39
15:36:39
(10 rows)
-- --
-- TIME simple math -- TIME simple math
......
This diff is collapsed.
This diff is collapsed.
...@@ -12,6 +12,11 @@ INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT'); ...@@ -12,6 +12,11 @@ INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT');
INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT'); INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT');
INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT'); INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT');
INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT'); INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT');
INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
-- this should fail (the timezone offset is not known)
INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York');
ERROR: invalid input syntax for type time with time zone: "15:36:39 America/New_York"
SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; SELECT f1 AS "Time TZ" FROM TIMETZ_TBL;
Time TZ Time TZ
---------------- ----------------
...@@ -25,7 +30,9 @@ SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; ...@@ -25,7 +30,9 @@ SELECT f1 AS "Time TZ" FROM TIMETZ_TBL;
12:01:00-07 12:01:00-07
23:59:00-07 23:59:00-07
23:59:59.99-07 23:59:59.99-07
(10 rows) 15:36:39-05
15:36:39-04
(12 rows)
SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07';
Three Three
...@@ -45,7 +52,9 @@ SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07'; ...@@ -45,7 +52,9 @@ SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07';
12:01:00-07 12:01:00-07
23:59:00-07 23:59:00-07
23:59:59.99-07 23:59:59.99-07
(7 rows) 15:36:39-05
15:36:39-04
(9 rows)
SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07'; SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07';
None None
...@@ -65,7 +74,9 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; ...@@ -65,7 +74,9 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07';
12:01:00-07 12:01:00-07
23:59:00-07 23:59:00-07
23:59:59.99-07 23:59:59.99-07
(10 rows) 15:36:39-05
15:36:39-04
(12 rows)
-- --
-- TIME simple math -- TIME simple math
......
...@@ -14,6 +14,12 @@ INSERT INTO TIME_TBL VALUES ('12:01'); ...@@ -14,6 +14,12 @@ INSERT INTO TIME_TBL VALUES ('12:01');
INSERT INTO TIME_TBL VALUES ('23:59'); INSERT INTO TIME_TBL VALUES ('23:59');
INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM'); INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM');
INSERT INTO TIME_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
-- this should fail (the timezone offset is not known)
INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York');
SELECT f1 AS "Time" FROM TIME_TBL; SELECT f1 AS "Time" FROM TIME_TBL;
SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07';
......
...@@ -86,6 +86,11 @@ INSERT INTO TIMESTAMP_TBL VALUES ('97/02/10 17:32:01 UTC'); ...@@ -86,6 +86,11 @@ INSERT INTO TIMESTAMP_TBL VALUES ('97/02/10 17:32:01 UTC');
reset datestyle; reset datestyle;
INSERT INTO TIMESTAMP_TBL VALUES ('1997.041 17:32:01 UTC'); INSERT INTO TIMESTAMP_TBL VALUES ('1997.041 17:32:01 UTC');
INSERT INTO TIMESTAMP_TBL VALUES ('19970210 173201 America/New_York');
-- this fails
INSERT INTO TIMESTAMP_TBL VALUES ('19970710 173201 America/Does_not_exist');
-- Check date conversion and date arithmetic -- Check date conversion and date arithmetic
INSERT INTO TIMESTAMP_TBL VALUES ('1997-06-10 18:32:01 PDT'); INSERT INTO TIMESTAMP_TBL VALUES ('1997-06-10 18:32:01 PDT');
......
...@@ -80,6 +80,14 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('97/02/10 17:32:01 UTC'); ...@@ -80,6 +80,14 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('97/02/10 17:32:01 UTC');
reset datestyle; reset datestyle;
INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997.041 17:32:01 UTC'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997.041 17:32:01 UTC');
-- timestamps at different timezones
INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970210 173201 America/New_York');
SELECT '19970210 173201' AT TIME ZONE 'America/New_York';
INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/New_York');
SELECT '19970710 173201' AT TIME ZONE 'America/New_York';
INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist');
SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist';
-- Check date conversion and date arithmetic -- Check date conversion and date arithmetic
INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT');
......
...@@ -15,6 +15,11 @@ INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT'); ...@@ -15,6 +15,11 @@ INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT');
INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT'); INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT');
INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT'); INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT');
INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
-- this should fail (the timezone offset is not known)
INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York');
SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; SELECT f1 AS "Time TZ" FROM TIMETZ_TBL;
SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment