Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle
Дата
Msg-id 4915F13C.7060800@cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> BTW, I just noticed that CVS HEAD has a bug in reading negative SQL-spec
> literals:
> regression=# select interval '-2008-10';         
> regression=# select interval '-0000-10';
> Surely the latter must mean -10 months.  This is orthogonal to the
> current patch ...

Perhaps the below patch fixes that?
(though line numbers probably won't match since this was based off
of the patched version)



*** a/src/backend/utils/adt/datetime.c
--- b/src/backend/utils/adt/datetime.c
***************
*** 2879,2885 **** DecodeInterval(char **field, int *ftype, int nf, int range,                      if (*cp != '\0')
                     return DTERR_BAD_FORMAT;                      type = DTK_MONTH;
 
!                     if (val < 0)                          val2 = -val2;                      val = val *
MONTHS_PER_YEAR+ val2;                      fval = 0;
 
--- 2879,2885 ----                      if (*cp != '\0')                          return DTERR_BAD_FORMAT;
       type = DTK_MONTH;
 
!                     if (field[0][0] == '-')                          val2 = -val2;                      val = val *
MONTHS_PER_YEAR+ val2;                      fval = 0;
 
[5]lt:/home/ramayer/proj/pg/postgresql/src/backend/utils/adt%



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

Предыдущее
От: Paul Schlie
Дата:
Сообщение: Re: Block-level CRC checks
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle