aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-10-27 02:45:22 +0000
committerBruce Momjian <bruce@momjian.us>2005-10-27 02:45:22 +0000
commit69f16b562a9088d708a588333afcf16e84317a4e (patch)
tree95ccb9001130b462e6dc61c02e7a49c24fdb860d /src/backend/utils/adt/timestamp.c
parent807da29cf3eb3cabf268a96e8bef03f8e0bd10fe (diff)
downloadpostgresql-69f16b562a9088d708a588333afcf16e84317a4e.tar.gz
postgresql-69f16b562a9088d708a588333afcf16e84317a4e.zip
Add comment documenting actual failure case of using
interval_justify_hours in timestamp subtraction. TODO already has text description.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index b4a518a1da4..43956597e31 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.156 2005/10/25 17:13:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.157 2005/10/27 02:45:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1943,8 +1943,31 @@ timestamp_mi(PG_FUNCTION_ARGS)
result->month = 0;
result->day = 0;
- /* this is wrong, but removing it breaks a lot of regression tests */
- result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ /*
+ * This is wrong, but removing it breaks a lot of regression tests.
+ * For example:
+ *
+ * test=> SET timezone = 'EST5EDT';
+ * test=> SELECT
+ * test-> ('2005-10-30 13:22:00-05'::timestamptz -
+ * test(> '2005-10-29 13:22:00-04'::timestamptz);
+ * ?column?
+ * ----------------
+ * 1 day 01:00:00
+ * (1 row)
+ *
+ * so adding that to the first timestamp gets:
+ *
+ * test=> SELECT
+ * test-> ('2005-10-29 13:22:00-04'::timestamptz +
+ * test(> ('2005-10-30 13:22:00-05'::timestamptz -
+ * test(> '2005-10-29 13:22:00-04'::timestamptz)) at time zone 'EST';
+ * timezone
+ * --------------------
+ * 2005-10-30 14:22:00
+ * (1 row)
+ */
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
PG_RETURN_INTERVAL_P(result);