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 1r6YCp-001Khs-Pv for pgsql-general@arkaria.postgresql.org; Fri, 24 Nov 2023 15:34:59 +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 1r6YCn-00CSWX-01 for pgsql-general@arkaria.postgresql.org; Fri, 24 Nov 2023 15:34:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6YCm-00CSWP-LS for pgsql-general@lists.postgresql.org; Fri, 24 Nov 2023 15:34:56 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6YCf-008JGD-KT for pgsql-general@lists.postgresql.org; Fri, 24 Nov 2023 15:34:55 +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 3AOFYjJp3307509; Fri, 24 Nov 2023 10:34:46 -0500 From: Tom Lane To: Zahir Lalani cc: Ron Johnson , "pgsql-generallists.postgresql.org" Subject: Re: Odd Shortcut behaviour in PG14 In-reply-to: References: <3170786.1700768723@sss.pgh.pa.us> Comments: In-reply-to Zahir Lalani message dated "Fri, 24 Nov 2023 13:00:59 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3307507.1700840085.1@sss.pgh.pa.us> Date: Fri, 24 Nov 2023 10:34:45 -0500 Message-ID: <3307508.1700840085@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Zahir Lalani writes: > Looking at the application logs this function is being called once per > display row - it is running successfully around 10 times with the same > input params. When it fails, it is with the same params! You *still* haven't defined what you mean by "fails". We can't help you effectively with such tiny dribs and drabs of information. At the very least I'd like to see the whole query, because the fragment you've shown us does not reveal what ekey is or why you think the system should believe that it is or is not zero. But it's also unclear why that should matter. Having said that ... if the statement is being executed with a cached plan (via a named statement, or PREPARE, or inside plpgsql) then maybe the problem occurs if the plan switches from custom to generic? If so, messing with the plan_cache_mode setting might provide a workaround. regards, tom lane