Re: BUG #1609: Bug in interval datatype for 64 Bit timestamps

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #1609: Bug in interval datatype for 64 Bit timestamps
Дата
Msg-id 3036.1114017359@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #1609: Bug in interval datatype for 64 Bit timestamps  ("Oliver Siegmar" <oliver@siegmar.net>)
Список pgsql-bugs
I've applied this patch.

            regards, tom lane

Index: datetime.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v
retrieving revision 1.137
diff -c -r1.137 datetime.c
*** datetime.c    11 Jan 2005 18:33:45 -0000    1.137
--- datetime.c    20 Apr 2005 17:09:57 -0000
***************
*** 3883,3899 ****
              /* fractional seconds? */
              if (fsec != 0)
              {
  #ifdef HAVE_INT64_TIMESTAMP
                  if (is_before || ((!is_nonzero) && (tm->tm_sec < 0)))
                      tm->tm_sec = -tm->tm_sec;
                  sprintf(cp, "%s%d.%02d secs", (is_nonzero ? " " : ""),
!                         tm->tm_sec, (((int) fsec) / 10000));
                  cp += strlen(cp);
-                 if (!is_nonzero)
-                     is_before = (fsec < 0);
  #else
-                 fsec_t        sec;
-
                  fsec += tm->tm_sec;
                  sec = fsec;
                  if (is_before || ((!is_nonzero) && (fsec < 0)))
--- 3883,3907 ----
              /* fractional seconds? */
              if (fsec != 0)
              {
+                 fsec_t        sec;
+
  #ifdef HAVE_INT64_TIMESTAMP
+                 sec = fsec;
                  if (is_before || ((!is_nonzero) && (tm->tm_sec < 0)))
+                 {
                      tm->tm_sec = -tm->tm_sec;
+                     sec = -sec;
+                     is_before = TRUE;
+                 }
+                 else if ((!is_nonzero) && (tm->tm_sec == 0) && (fsec < 0))
+                 {
+                     sec = -sec;
+                     is_before = TRUE;
+                 }
                  sprintf(cp, "%s%d.%02d secs", (is_nonzero ? " " : ""),
!                         tm->tm_sec, (((int) sec) / 10000));
                  cp += strlen(cp);
  #else
                  fsec += tm->tm_sec;
                  sec = fsec;
                  if (is_before || ((!is_nonzero) && (fsec < 0)))
***************
*** 3905,3913 ****
                      is_before = (fsec < 0);
  #endif
                  is_nonzero = TRUE;
-
-                 /* otherwise, integer seconds only? */
              }
              else if (tm->tm_sec != 0)
              {
                  int            sec = tm->tm_sec;
--- 3913,3920 ----
                      is_before = (fsec < 0);
  #endif
                  is_nonzero = TRUE;
              }
+             /* otherwise, integer seconds only? */
              else if (tm->tm_sec != 0)
              {
                  int            sec = tm->tm_sec;

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1609: Bug in interval datatype for 64 Bit timestamps
Следующее
От: Oliver Siegmar
Дата:
Сообщение: Re: BUG #1609: Bug in interval datatype for 64 Bit timestamps