TransactionIdGetCommitTsData and its dereferenced pointers

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема TransactionIdGetCommitTsData and its dereferenced pointers
Дата
Msg-id CAB7nPqS_kF7vJaQA6qNbcuQnr5B6JBDyxAz5MuXPsB3KtmoBbA@mail.gmail.com
обсуждение исходный текст
Ответы Re: TransactionIdGetCommitTsData and its dereferenced pointers  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Hi all,

TransactionIdGetCommitTsData@commit_ts.c does the following:
    if (ts)
        *ts = entry.time;
    [...]
    return *ts != 0;
This is a bad idea, because if TransactionIdGetCommitTsData is called
with ts == NULL this would simply crash. It seems to me that it makes
little sense to have ts == NULL either way because this function is
intended to return a timestamp in any case, hence I think that we
should simply Assert(ts == NULL) and remove those checks.

Petr, Alvaro, perhaps you intended something like the patch attached,
or perhaps something like that? This would be useful to not ERROR
should an OOM happen when allocating a timestamp pointer, though I
doubt that this is the first intention:
return ts != NULL ? *ts != 0 : false;
Regards,
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: WIP: SCRAM authentication
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Raising our compiler requirements for 9.6