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 1wRv2E-002o4B-2j for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 16:53: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 1wRv2C-005Ia0-2V for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 16:53:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRv2C-005IZm-1W for pgsql-hackers@lists.postgresql.org; Tue, 26 May 2026 16:53:41 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wRv2A-00000000smm-2lLj for pgsql-hackers@postgresql.org; Tue, 26 May 2026 16:53:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xFe+hRcnnbSm7PoHG66al4TbhoIOKg4qI3ADedhkvMk=; b=wSiFvml9ow6q8Con6B9T0Js1XM dFC+3HbKOBIVan2esMnvY9Y2WCajmEu6hZjCG/UTSP3RjfNyc63Hm/eQV0daX8V0q3mVu5R4ktfWY yhvN8X1lOIbPHpoDQqME1tRALcQsJh7iqREluZa8cQWRAo4qREj4GLGQnpueQIEmyxnTNx/roKXvI Ug80VuC/cz8f5srWjICOk0NbsBQetjmmfhtXMvlyqO5tXrdtSqQ43QBayFc1AdD72C4kKshUwP6Ty rnE+/536Pd8CJu97PUnWeOWI/yWLiIrRlifP0HVATmGNd3xA9ZJqGPbtj++z0Sr9mQv45IY9M6jbx mTvst75Q==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wRv23-002UVR-1S; Tue, 26 May 2026 16:53:31 +0000 Date: Tue, 26 May 2026 18:53:31 +0200 From: Christoph Berg To: Nathan Bossart Cc: pgsql-hackers@postgresql.org Subject: Re: future of PQfn() Message-ID: Mail-Followup-To: Christoph Berg , Nathan Bossart , pgsql-hackers@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Debian-User: myon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: Nathan Bossart > PQfn() was marked "somewhat obsolete" in commit efc3a25bb0 (2003), and was > later marked "unsafe" in commit bd48114937 (2026). I looked around for > third-party code that uses this interface but found none I found some references via Debian's codesearch: https://sources.debian.org/src/fpc/3.2.2+dfsg-50/fpcsrc/packages/postgres/src/postgres3dyn.pp?hl=141#L141 PQfn : function (conn:PPGconn; fnid:longint; result_buf:Plongint; result_len:Plongint; result_is_int:longint;args:PPQArgBlock; nargs:longint):PPGresult;cdecl; { Accessor functions for PGresult objects } https://sources.debian.org/src/clisp/1:2.49.20250504.gitf662209-2/modules/postgresql/postgresql.lisp?hl=375#L375 ;; "Fast path" interface --- not really recommended for application use (def-call-out PQfn (:return-type PGresult) (:arguments (conn PGconn) (fnid int) (result_buf (c-ptr int) :out) (result_len (c-ptr int) :out) (result_is_int int) (args (c-array-ptr PQArgBlock)) ; at least nargs (nargs int))) https://sources.debian.org/src/rust-pq-sys/0.7.5-1/src/bindings_linux_32.rs?hl=745#L745 unsafe extern "C" { pub fn PQfn( conn: *mut PGconn, fnid: ::std::os::raw::c_int, result_buf: *mut ::std::os::raw::c_int, result_len: *mut ::std::os::raw::c_int, result_is_int: ::std::os::raw::c_int, args: *const PQArgBlock, nargs: ::std::os::raw::c_int, ) -> *mut PGresult; } https://sources.debian.org/src/vala/0.56.19-1/vapi/libpq.vapi?hl=349#L349 [CCode (cname = "PQfn")] public Result fn (int fnid, [CCode (array_length = false)] int[] result_buf, out int result_len, int result_is_int, ArgBlock[] args); https://sources.debian.org/src/libdbi-drivers/0.9.0-13/drivers/pgsql/dbd_pgsql.h?hl=650#L650 #define PGSQL_CUSTOM_FUNCTIONS { \ ... "PQfn", \ All seem to be libpq wrappers. Then there is a handful of packages with a copy of libpq-fe.h that includes the function declaration. ... plus two other mentioning PQfn as "unimplemented". > Given the above, I'd like to propose retiring PQfn() in v20. Since it's an > exported symbol, we can't just delete the code, but we could have it > unconditionally error. Keeping the symbol but making it return an error seems ok from the above I think. Christoph