Missing checks on return value of timestamp2tm in datetime.c

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Missing checks on return value of timestamp2tm in datetime.c
Дата
Msg-id CAB7nPqRSk=J8eUdd55fL-w+k=8sDTHLVBt-cgG9jWN=VO2ogBQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Missing checks on return value of timestamp2tm in datetime.c
Список pgsql-hackers
Hi all,

timestamp2tm is called close to 40 times in the backend source code, returning -1 in case of failure. However, there are two places in datetime.c where we do not check for its return value: GetCurrentDateTime and GetCurrentTimeUsec.
This does not really matter much in practice as the timestamp used is GetCurrentTransactionStartTimestamp(), but for correctness shouldn't we check for its return code and report ERRCODE_DATETIME_VALUE_OUT_OF_RANGE on error?

Per se the patch attached.
Regards,
--
Michael

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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: Dereferenced pointer in tablesample.c
Следующее
От: Michael Paquier
Дата:
Сообщение: Unneeded NULL-pointer check in FreeSpaceMapTruncateRel