Repair two TIME WITH TIME ZONE bugs found by Dennis Vshivkov. Comparison
authorTom Lane <[email protected]>
Sat, 23 Apr 2005 22:54:23 +0000 (22:54 +0000)
committerTom Lane <[email protected]>
Sat, 23 Apr 2005 22:54:23 +0000 (22:54 +0000)
of timetz values misbehaved in --enable-integer-datetime cases, and
EXTRACT(EPOCH) subtracted the zone instead of adding it in all cases.
Backpatch to all supported releases (except --enable-integer-datetime code
does not exist in 7.2).

src/backend/utils/adt/date.c

index 03051dd4b1941d434ea9eb5160077900ac6d20ff..f14d2f7a7b2309c2de25334ed4bd62499f8630a9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.64.2.3 2002/09/30 20:57:10 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.64.2.4 2005/04/23 22:54:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1553,7 +1553,7 @@ timetz_part(PG_FUNCTION_ARGS)
                }
        }
        else if ((type == RESERV) && (val == DTK_EPOCH))
-               result = time->time - time->zone;
+               result = time->time + time->zone;
        else
        {
                elog(ERROR, "TIMETZ units '%s' not recognized",