Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVfkY-0001M0-Sf for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Sep 2021 20:00:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mVfkX-0002Cy-Eo for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Sep 2021 20:00:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVfkX-0002Co-6s for pgsql-hackers@lists.postgresql.org; Wed, 29 Sep 2021 20:00:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVfkU-0005Ho-0S; Wed, 29 Sep 2021 20:00:15 +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 18TK0COp2998378; Wed, 29 Sep 2021 16:00:12 -0400 From: Tom Lane To: Jaime Casanova cc: pgsql-hackers@postgresql.org, David Rowley Subject: Re: jsonb crash In-reply-to: <20210929185544.GB24346@ahch-to> References: <20210929185544.GB24346@ahch-to> Comments: In-reply-to Jaime Casanova message dated "Wed, 29 Sep 2021 13:55:44 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2998376.1632945612.1@sss.pgh.pa.us> Date: Wed, 29 Sep 2021 16:00:12 -0400 Message-ID: <2998377.1632945612@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jaime Casanova writes: > I found a crash (segmentation fault) on jsonb. > This is the best I could do to reduce the query: > """ > select > 75 as c1 > from > public.pagg_tab_ml as ref_0, > lateral (select > ref_0.a as c5 > from generate_series(1, 300) as sample_0 > fetch first 78 rows only > ) as subq_0 > where case when (subq_0.c5 < 2) > then cast(null as jsonb) > else cast(null as jsonb) > end ? ref_0.c > """ I think this must be a memoize bug. AFAICS, nowhere in this query can we be processing a non-null JSONB value, so what are we doing in jsonb_hash? Something down-stack must have lost the information that the Datum is actually null. regards, tom lane