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 1uO5SA-00Emf6-9P for pgsql-bugs@arkaria.postgresql.org; Sun, 08 Jun 2025 02:08:06 +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 1uO5S7-00GDEO-8C for pgsql-bugs@arkaria.postgresql.org; Sun, 08 Jun 2025 02:08:03 +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 1uO5S6-00GDEG-WA for pgsql-bugs@lists.postgresql.org; Sun, 08 Jun 2025 02:08:03 +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.96) (envelope-from ) id 1uO5S5-000ndq-36 for pgsql-bugs@lists.postgresql.org; Sun, 08 Jun 2025 02:08:03 +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 55827xuD081947; Sat, 7 Jun 2025 22:07:59 -0400 From: Tom Lane To: Lowell Hought cc: Laurenz Albe , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18950: pgsql function that worked in Postgresql 16 does not return in Postgresql 17 In-reply-to: <75D714EA-CD1E-4F80-A2E8-29E378EC2200@gmail.com> References: <75D714EA-CD1E-4F80-A2E8-29E378EC2200@gmail.com> Comments: In-reply-to Lowell Hought message dated "Sat, 07 Jun 2025 20:40:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <81945.1749348479.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 07 Jun 2025 22:07:59 -0400 Message-ID: <81946.1749348479@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Lowell Hought writes: > If I run the query outside of the function it works as expected. But th= e function never returns. This isn't that surprising either: a query inside a function is often translated into a "generic" plan that doesn't depend on specific parameter values, typically sacrificing runtime to avoid repeated planning. Does it get any better if you do "set plan_cache_mode =3D force_custom_plan" before running the function? regards, tom lane