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 1olxKu-0002mU-Oi for pgsql-general@arkaria.postgresql.org; Fri, 21 Oct 2022 19:05:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1olxKt-0002su-C6 for pgsql-general@arkaria.postgresql.org; Fri, 21 Oct 2022 19:05:39 +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 1olxKt-0002sl-1U for pgsql-general@lists.postgresql.org; Fri, 21 Oct 2022 19:05:39 +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 1olxKp-0007aG-2e for pgsql-general@postgresql.org; Fri, 21 Oct 2022 19:05:38 +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 29LJ5VTJ3242465; Fri, 21 Oct 2022 15:05:31 -0400 From: Tom Lane To: Les cc: pgsql-general@postgresql.org Subject: Re: possible bug In-reply-to: References: Comments: In-reply-to Les message dated "Fri, 21 Oct 2022 19:50:39 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3242463.1666379131.1@sss.pgh.pa.us> Date: Fri, 21 Oct 2022 15:05:31 -0400 Message-ID: <3242464.1666379131@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Les writes: > We had a support request today, and we have narrowed down the problem to a > query that behaves very strangely. The actual query was much more > complicated, but I came up with this minimal example. Which PG version is this exactly? Given the Memoize node shown in your plan, I suppose 14.something, but is it up to date? There were Memoize-related bug fixes in 14.2 and 14.4, and the one in 14.2 looks particularly likely to be relevant. If you are on the current minor release, does "set enable_memoize = off" change the behavior? regards, tom lane