Обсуждение: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM

Поиск
Список
Период
Сортировка

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

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      18232
Logged by:          RekGRpth
Email address:      rekgrpth@gmail.com
PostgreSQL version: 16.1
Operating system:   all
Description:

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


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