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.96) (envelope-from ) id 1wSyv3-000ErW-26 for pgsql-hackers@arkaria.postgresql.org; Fri, 29 May 2026 15:14:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSyv0-002sBF-2H for pgsql-hackers@arkaria.postgresql.org; Fri, 29 May 2026 15:14:39 +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.96) (envelope-from ) id 1wSyv0-002sB7-0n for pgsql-hackers@lists.postgresql.org; Fri, 29 May 2026 15:14:38 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wSyux-000000009o5-3Rym for pgsql-hackers@postgresql.org; Fri, 29 May 2026 15:14:38 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-47c35be02fdso5166763b6e.3 for ; Fri, 29 May 2026 08:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780067673; x=1780672473; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=DgfyVSW0yWRPn+IEA80l4II6yiU5lHe7NRufU2e6v0U=; b=Fz6hXNsJ2Q1os4/axOD/f2xiP7qZvj/qTW+dFTa0EGqSL+08RUbGQMnMnX71F5j/mK D7xztw26lN1jaY7MFlcpLSpYpe9mO7ZL8zcfiLPs6Jy5W7qx+QfjCR8cK2afq/gwoP7A qkj0Ux6C7gzJNgTNYdEPpZ5fAWnKuE0NhgKBYLF48hKEt8Gpo6TUyLOvGB29UCJzBXlU 7QBFAQ+YbxQV2ohATn4FwEKpQkkoaft8UbRUrWy+ZUJdJ2SNxCRanQ43J82IMy3Zo51Z o/po5FhX0ODAG23nH9lyVYLGBcJcOEyeUuQnlqRVkQH5+lVNEIT559hS+xY7oCLtNXJY gBOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780067673; x=1780672473; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DgfyVSW0yWRPn+IEA80l4II6yiU5lHe7NRufU2e6v0U=; b=nbyTY7g5KBXYGepFpP9FD/ICObf6joiZ4lr1wxpeapkI1tf+LtMh0MmZ766TTFqVbG 2z8YRgQIN/XFjrVSQLwk48Clka7Q4ZWXwjOrVmCd/z99GKOjYmIBQoIbM9cghkaK0xQu B0i+uxFOgtoCcE+UicPnff4AoZgMX2BwAUqmcUpn4RPRjxmK8xcraLk/w+hOugTPU2X7 Oxm4NyjZs0SLukHbflJ60/bz96/rHyQJBLpAjIOph3aNPHK7/3rnX3+xxZOVObXQ82GR QonGO8fGygNKXX30Q9FyRog0XYNHUHfjk4t8YKSjFOObYEN373Nga7tlcsU3DL7P5rTz +SZA== X-Gm-Message-State: AOJu0YzohB2ZDQS9KnF9DwtD2TiGif1gSaXH7KeyA41RiBJHsr/0hPog mLHT/U7qqQjQuTzKWf4HVKi6QPn2xaY2NzHmpxIdHu04G81Vbm171Fxm X-Gm-Gg: Acq92OGC7LQb4As557gTn1cc1ZWeLrMspWVkkCXebnGVnS8j1THRN7K6IqJ1atywkeI ikL3pMkFt2xf3pw3eu9Hq3pIx/Gp9O5qLax869spnMVwtDJWA3ctQajmXd7IxzJoK7w3aQSspMc Q/JKSFlmXR1VsUWCZWxln+irVhaQVst2n8NhAKn7OVzVjz7EdRHv3drhIiihFEzm2ZdBx7Uj/n6 +beFK7pj+Kp01ZTsZ9VyqJUxNXXyt0C4FO7tDem38SfEVyHq4OH1NrDPfbnYrvATYlC/cUw//eS 7A3+wBKijIvQM+TL7wR37B7ml0OVSv48HPMzNEFGKEUfqPfN027aOA2XUdnIFiTsKzyeNbh5sL1 FcdJeBzGb0vacNE4/ZIpzqDkcaom1N+ra2R1U+LvUibysjsyVfYZj/Q/aLPHfr8QPKqp+yDgIBj HNmGvitbUQRV7Ye4jfV4t0R9wTkA3rhDhQb5zS7k8bMQNtf10xojgVi+qavhRw4wTOdeMZo4FtL ToXwVJ+iSI6vYdsihPzxvDuckkkz3Dm X-Received: by 2002:a05:6808:1b99:b0:46c:e542:cc3e with SMTP id 5614622812f47-485e6a4ddcemr1932523b6e.6.1780067672880; Fri, 29 May 2026 08:14:32 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43c93ef894bsm1175636fac.10.2026.05.29.08.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 08:14:31 -0700 (PDT) Date: Fri, 29 May 2026 10:14:29 -0500 From: Nathan Bossart To: Jacob Champion Cc: pgsql-hackers@postgresql.org Subject: Re: future of PQfn() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wfzLmV/Wl0ehOJBp" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wfzLmV/Wl0ehOJBp Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, May 27, 2026 at 02:39:53PM -0700, Jacob Champion wrote: > On Tue, May 26, 2026 at 12:55 PM Nathan Bossart > wrote: >> I wonder how difficult it would be to teach the protocol to advise clients >> when prepared statements are deallocated... > > Probably not too difficult. But it seems like most, if not all, of the > stuff in the DISCARD ALL umbrella is a target for a feature like > that... This feels a lot like the perennial request for proxies to be > able to separate their own context from the per-application/per-user > contexts running on top of them. Here is a work-in-progress patch set that goes this direction. This introduces a callback mechanism in libpq that is used to handle statement deallocation notifications. Older servers/clients fall back to PQexecParams(), which is slower, but the alternative is to leave PQnfn() and related code around indefinitely. I'm wondering whether this new message type is general enough. For example, perhaps we could make an extensible message type for tracking various things. And I want to ensure this is useful for other clients, too. -- nathan --wfzLmV/Wl0ehOJBp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v2-0001-tell-client-when-prep-stmts-are-deallocated.patch