Re: Strange interval arithmetic

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Strange interval arithmetic
Дата
Msg-id 1653.1133389254@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Strange interval arithmetic  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Strange interval arithmetic  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-hackers
Michael Fuhr <mike@fuhr.org> writes:
>   errno = 0;
>   val = strtol(field[i], &cp, 10);
>   if (errno == ERANGE)
>       return DTERR_FIELD_OVERFLOW;

> Does that look okay?  Or would you rather raise an error with ereport()?

Looks fine to me, at least in the routines that are for datetime stuff.

> I'm looking at all the strtol() calls in datetime.c right now; I
> haven't looked anywhere else yet.  Should I bother checking values
> that will be range checked later anyway?  Time zone displacements,
> for example?

Good question.  Is strtol guaranteed to return INT_MAX or INT_MIN on
overflow, or might it return the overflowed value?
        regards, tom lane


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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Strange interval arithmetic
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Strange interval arithmetic