Re: Issue in Behavior of Interval Datatype

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Issue in Behavior of Interval Datatype
Дата
Msg-id 10515.1344025083@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Issue in Behavior of Interval Datatype  (Amit Kapila <amit.kapila@huawei.com>)
Ответы Re: Issue in Behavior of Interval Datatype
Список pgsql-hackers
Amit Kapila <amit.kapila@huawei.com> writes:
> select (interval '56:48'  minute to second);
> result$B!'(B00:56:48
> select (interval '-56:48'  minute to second);
> result$B!'(B-56:48:00
> select (interval '+56:48'  minute to second);
> result$B!'(B56:48:00

> I have checked the code and found that in function DecodeInterval(), for
> timezone case (DTK_TZ) it uses INTERVAL_FULL_RANGE irrespective of range
> passed by user.

> However if use the range passed as argument in function DecodeInterval(),
> the result of using $B!F(B+$B!G(B or $B!F(B-$B!F(B is same as without using it.

> Is there any particular reason for ignoring the range for DTK_TZ case in
> DecodeInterval() function?

I think you are right; this if-block should be exactly like the DTK_TIME
case except for handling the prepended sign.  That also raises the
question why it is changing the tmask value returned by DecodeTime.
It seems to be doing exactly the wrong thing there.  Test case:

regression=# select (interval '56:48 56:48'  );
ERROR:  invalid input syntax for type interval: "56:48 56:48"
LINE 1: select (interval '56:48 56:48'  );                        ^
regression=# select (interval '56:48 +56:48'  );interval 
----------56:48:00
(1 row)

The second one fails to fail because an inappropriate tmask value got
included into fmask.

Will fix.
        regards, tom lane


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: [PATCH] Docs: Make notes on sequences and rollback more obvious
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: [PATCH] Docs: Make notes on sequences and rollback more obvious