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 1mVgpv-0004gj-0y for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Sep 2021 21:09:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mVgpt-0007Gf-OD for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Sep 2021 21:09:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVgpt-0007GX-GX for pgsql-hackers@lists.postgresql.org; Wed, 29 Sep 2021 21:09:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVgpq-0006WG-VC; Wed, 29 Sep 2021 21:09:53 +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 18TL9mek3001999; Wed, 29 Sep 2021 17:09:48 -0400 From: Tom Lane To: David Rowley cc: David Rowley , Jaime Casanova , PostgreSQL-development Subject: Re: jsonb crash In-reply-to: References: <20210929185544.GB24346@ahch-to> <2998377.1632945612@sss.pgh.pa.us> <2999546.1632947043@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Thu, 30 Sep 2021 09:48:03 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3001997.1632949788.1@sss.pgh.pa.us> Date: Wed, 29 Sep 2021 17:09:48 -0400 Message-ID: <3001998.1632949788@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Thu, 30 Sept 2021 at 09:24, Tom Lane wrote: >> After further inspection, "what are we doing in jsonb_hash?" is >> indeed a relevant question, but it seems like it's a type mismatch >> not a nullness issue. EXPLAIN VERBOSE shows > I think you're right here. It should be hashing text. That seems to > be going wrong in check_memoizable() because it assumes it's always > fine to use the left side's type of the OpExpr to figure out the hash > function to use. > Maybe we can cache the left and the right type's hash function and use > the correct one in paraminfo_get_equal_hashops(). Um ... it seems to have correctly identified the cache key expressions, so why isn't it just doing exprType on those? The jsonb_exists operator seems entirely irrelevant here. regards, tom lane