Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM
Date
Msg-id 1267887.1701959445@sss.pgh.pa.us
Whole thread Raw
In response to BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM  (PG Bug reporting form <noreply@postgresql.org>)
List 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 by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex
Next
From: Tom Lane
Date:
Subject: Re: BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex