Re: INTERVAL SECOND limited to 59 seconds?

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: INTERVAL SECOND limited to 59 seconds?
Дата
Msg-id 4A2F1F3B.1080308@cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Re: INTERVAL SECOND limited to 59 seconds?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: INTERVAL SECOND limited to 59 seconds?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> I wrote:
>> I'm inclined to say that these two cases are out of line with what
>> the rest of the code does and we should change them.
>  ...
> Now, all three of these cases throw "invalid input syntax" in 8.3,
> so this is not a regression from released behavior.  The question
> is does anyone think that these syntaxes should be valid?  They're
> not legal per spec, for sure, and they seem pretty ambiguous to me.

Seems to do a sane thing for all sane inputs I threw at it.

It still accepts one odd input that 8.3 rejected:
    regression=# select interval '1 1' hour;
Perhaps the additional patch below fixes that?


***************
*** 3022,3028 **** DecodeInterval(char **field, int *ftype, int nf, int range,
                          tm->tm_hour += val;
                          AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR);
                          tmask = DTK_M(HOUR);
!                         type = DTK_DAY;    /* set for next field */
                          break;

                      case DTK_DAY:
--- 3022,3029 ----
                          tm->tm_hour += val;
                          AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR);
                          tmask = DTK_M(HOUR);
!                         if (range == (INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR)))
!                             type = DTK_DAY;    /* set for next field */
                          break;

                      case DTK_DAY:






It also gives different answers than 8.3 for "select interval '1 1:' hour"
but I guess that's intended, right?


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: INTERVAL SECOND limited to 59 seconds?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: INTERVAL SECOND limited to 59 seconds?