Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM
Дата
Msg-id 1267887.1701959445@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY,
> WJB_VALUE and WJB_ELEM
> So I can call pushJsonbValue(NULL, WJB_VALUE, NULL) and get Segmentation
> fault

What's your point?  If we did have such Asserts, the process would
still crash if you did that.

In general I don't find a lot of value in Assert'ing that a pointer
isn't null in code that is about to dereference it.  You'll get a
clearly-interpretable process crash either way, so an Assert seems
like useless code bloat.  Others might have a different opinion,
but surely this is a matter of style not a bug.  We've not chosen
to have any particular project style on this point.

            regards, tom lane



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex