Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBFOs-00A5FF-P9 for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Dec 2023 14:30:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rBFOr-000qkD-FL for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Dec 2023 14:30:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBFOr-000qk5-75 for pgsql-bugs@lists.postgresql.org; Thu, 07 Dec 2023 14:30:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBFOo-009GFs-Rr for pgsql-bugs@lists.postgresql.org; Thu, 07 Dec 2023 14:30:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3B7EUjpF1267888; Thu, 7 Dec 2023 09:30:45 -0500 From: Tom Lane To: rekgrpth@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM In-reply-to: <18232-27836d653eddfa97@postgresql.org> References: <18232-27836d653eddfa97@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 07 Dec 2023 11:21:34 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1267886.1701959445.1@sss.pgh.pa.us> Date: Thu, 07 Dec 2023 09:30:45 -0500 Message-ID: <1267887.1701959445@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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