Re: remaining sql/json patches

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: remaining sql/json patches
Дата
Msg-id 2797648.1694529821@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: remaining sql/json patches  (Peter Eisentraut <peter@eisentraut.org>)
Список pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> On 06.09.23 17:01, Alvaro Herrera wrote:
>> Assert()ing that a pointer is not null, and in the next line
>> dereferencing that pointer, is useless: the process would crash anyway
>> at the time of dereference, so the Assert() adds no value.  Better to
>> leave the assert out.

> I don't think this is quite correct.  If you dereference a pointer, the 
> compiler may assume that it is not null and rearrange code accordingly. 
> So it might not crash.  Keeping the assertion would alter that assumption.

Uh ... only in assert-enabled builds.  If your claim is correct,
this'd result in different behavior in debug and production builds,
which would be even worse.  But I don't believe the claim.
I side with Alvaro's position here: such an assert is unhelpful.

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Adding a pg_get_owned_sequence function?
Следующее
От: Dagfinn Ilmari Mannsåker
Дата:
Сообщение: Re: Adding a pg_get_owned_sequence function?