Commit 192061e4 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Repair bugs in declarations of routines to add timestamptz and interval.

 Thanks to Bruce for spotting it and Tom Lane for diagnosing it.
Since horology test output is changing anyway, add some date/time input
 tests to horology.sql. Some of these should move to the tests for the
 individual data types, and we perhaps should add an entire new test
 for "timezone" to allow manipulating the current time zone without
 risking damage to the results of other tests.
parent 0e1a5075
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.61 2001/12/29 18:31:31 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.62 2002/01/12 04:38:27 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1290,7 +1290,7 @@ timestamp_mi_span(PG_FUNCTION_ARGS) ...@@ -1290,7 +1290,7 @@ timestamp_mi_span(PG_FUNCTION_ARGS)
} }
/* timestamp_pl_span() /* timestamptz_pl_span()
* Add a interval to a timestamp with time zone data type. * Add a interval to a timestamp with time zone data type.
* Note that interval has provisions for qualitative year/month * Note that interval has provisions for qualitative year/month
* units, so try to do the right thing with them. * units, so try to do the right thing with them.
...@@ -1371,7 +1371,7 @@ timestamptz_mi_span(PG_FUNCTION_ARGS) ...@@ -1371,7 +1371,7 @@ timestamptz_mi_span(PG_FUNCTION_ARGS)
tspan.month = -span->month; tspan.month = -span->month;
tspan.time = -span->time; tspan.time = -span->time;
return DirectFunctionCall2(timestamp_pl_span, return DirectFunctionCall2(timestamptz_pl_span,
TimestampGetDatum(timestamp), TimestampGetDatum(timestamp),
PointerGetDatum(&tspan)); PointerGetDatum(&tspan));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_proc.h,v 1.221 2001/11/05 17:46:32 momjian Exp $ * $Id: pg_proc.h,v 1.222 2002/01/12 04:38:31 thomas Exp $
* *
* NOTES * NOTES
* The script catalog/genbki.sh reads this file and generates .bki * The script catalog/genbki.sh reads this file and generates .bki
...@@ -1458,9 +1458,9 @@ DESCR("age of a transaction ID, in transactions before current transaction"); ...@@ -1458,9 +1458,9 @@ DESCR("age of a transaction ID, in transactions before current transaction");
DATA(insert OID = 1188 ( timestamptz_mi PGUID 12 f t t t 2 f 1186 "1184 1184" 100 0 0 100 timestamp_mi - )); DATA(insert OID = 1188 ( timestamptz_mi PGUID 12 f t t t 2 f 1186 "1184 1184" 100 0 0 100 timestamp_mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1189 ( timestamptz_pl_span PGUID 12 f t t t 2 f 1184 "1184 1186" 100 0 0 100 timestamp_pl_span - )); DATA(insert OID = 1189 ( timestamptz_pl_span PGUID 12 f t t t 2 f 1184 "1184 1186" 100 0 0 100 timestamptz_pl_span - ));
DESCR("plus"); DESCR("plus");
DATA(insert OID = 1190 ( timestamptz_mi_span PGUID 12 f t t t 2 f 1184 "1184 1186" 100 0 0 100 timestamp_mi_span - )); DATA(insert OID = 1190 ( timestamptz_mi_span PGUID 12 f t t t 2 f 1184 "1184 1186" 100 0 0 100 timestamptz_mi_span - ));
DESCR("minus"); DESCR("minus");
DATA(insert OID = 1191 ( timestamptz PGUID 12 f t f t 1 f 1184 "25" 100 0 0 100 text_timestamptz - )); DATA(insert OID = 1191 ( timestamptz PGUID 12 f t f t 1 f 1184 "25" 100 0 0 100 text_timestamptz - ));
DESCR("convert text to timestamp with time zone"); DESCR("convert text to timestamp with time zone");
......
This diff is collapsed.
...@@ -5,6 +5,56 @@ ...@@ -5,6 +5,56 @@
SET australian_timezones = 'off'; SET australian_timezones = 'off';
SET DateStyle = 'Postgres,US'; SET DateStyle = 'Postgres,US';
--
-- Test various input formats
--
SELECT timestamp with time zone '20011227 040506+08';
SELECT timestamp with time zone '20011227 040506-08';
SELECT timestamp with time zone '20011227 040506.789+08';
SELECT timestamp with time zone '20011227 040506.789-08';
SELECT timestamp with time zone '20011227T040506+08';
SELECT timestamp with time zone '20011227T040506-08';
SELECT timestamp with time zone '20011227T040506.789+08';
SELECT timestamp with time zone '20011227T040506.789-08';
SELECT timestamp with time zone '2001-12-27 04:05:06.789-08';
SELECT timestamp with time zone '2001.12.27 04:05:06.789-08';
SELECT timestamp with time zone '2001/12/27 04:05:06.789-08';
SELECT timestamp with time zone '12/27/2001 04:05:06.789-08';
SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789+08';
SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789-08';
SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789+08';
SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789-08';
SELECT timestamp with time zone 'J2452271+08';
SELECT timestamp with time zone 'J2452271-08';
SELECT timestamp with time zone 'J2452271.5+08';
SELECT timestamp with time zone 'J2452271.5-08';
SELECT timestamp with time zone 'J2452271 04:05:06+08';
SELECT timestamp with time zone 'J2452271 04:05:06-08';
SELECT timestamp with time zone 'J2452271T040506+08';
SELECT timestamp with time zone 'J2452271T040506-08';
SELECT timestamp with time zone 'J2452271T040506.789+08';
SELECT timestamp with time zone 'J2452271T040506.789-08';
-- German/European-style dates with periods as delimiters
SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
SET DateStyle = 'German';
SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
SET DateStyle = 'ISO';
-- Reject time without time zone having a time zone specified
SELECT time without time zone '040506.789+08';
SELECT time without time zone '040506.789-08';
SELECT time without time zone 'T040506.789+08';
SELECT time without time zone 'T040506.789-08';
SELECT time with time zone '040506.789+08';
SELECT time with time zone '040506.789-08';
SELECT time with time zone 'T040506.789+08';
SELECT time with time zone 'T040506.789-08';
SELECT time with time zone 'T040506.789 +08';
SELECT time with time zone 'T040506.789 -08';
SET DateStyle = 'Postgres,US';
-- --
-- date, time arithmetic -- date, time arithmetic
-- --
......
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