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 1wMZjH-000Bmp-2z for pgsql-docs@arkaria.postgresql.org; Mon, 11 May 2026 23:08:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wMZjF-002bnx-0e for pgsql-docs@arkaria.postgresql.org; Mon, 11 May 2026 23:08:01 +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 1wMZjE-002bno-3B for pgsql-docs@lists.postgresql.org; Mon, 11 May 2026 23:08:01 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wMZjC-000000007oB-2CCE for pgsql-docs@lists.postgresql.org; Mon, 11 May 2026 23:08:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2026010100; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=yotQlHmfvvsvKryEIUuO6bW8/JmrT9U0TsYV3qoPolQ=; b=1y6AJ OCT/ZDL8hT2ltT4KRdE9ePl3k8IEtgLivROcVO1pywV+OGVGVxSLefcPO8VA4bxhEGu7LkioLRx1e GsDsXUTLWpo8bmTqrULaIrmuYDNM6PlY4S8OeiwfPJ9UIV6E8nBNVljovHiRNEfAkaDhkYAeq7E2z tSH0XJ8re4S6w4USuo2x3FfA4BDI/3VQRB22KmI3kIxAXn337L5VtDv1JDRV37Z1oBb8MRYj1urnB okNP5T8bpohfiwXzQVkvdzpzdzuBg67MVdGafX/UF710MiDbs2DlwkvLJEVQo6sovKrTA+4Ywfub9 dH8rJu6wd8j6I4UbOEjpSp2Qv0BGQ==; Received: from bruce by momjian.us with local (Exim 4.98.2) (envelope-from ) id 1wMZjB-00000004Gax-114Q; Mon, 11 May 2026 19:07:57 -0400 Date: Mon, 11 May 2026 19:07:57 -0400 From: Bruce Momjian To: Daniele Varrazzo Cc: pgsql-docs@lists.postgresql.org Subject: Re: Improve PQauthDataHook_type docs Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Apr 19, 2026 at 04:54:02PM +0100, Daniele Varrazzo wrote: > Hello, > > In https://www.postgresql.org/docs/18/libpq-oauth.html#LIBPQ-OAUTH-AUTHDATA-HOOKS > it is not entirely clear that `hook_fn` is the definition of the > `PQauthDataHook_type` used in the functions signature, because the > name is not used elsewhere. The function signatures refer to the > typedef but the typedef is not shown. > > Using https://www.postgresql.org/docs/18/libpq-notice-processing.html#LIBPQ-NOTICE-PROCESSING > as a guideline I suggest to show the typedef of the callback rather > than the `hook_fn` example, so that the `PQauthDataHook_type` name can > be searched for. > > Please check the patch attached. > Use the typedef name to make it easier to correlate to the functions > using this type definition. > --- > doc/src/sgml/libpq.sgml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml > index e50f0cbd8c7..f646244840d 100644 > --- a/doc/src/sgml/libpq.sgml > +++ b/doc/src/sgml/libpq.sgml > @@ -10280,7 +10280,7 @@ void PQsetAuthDataHook(PQauthDataHook_type hook); > default handler will be reinstalled. Otherwise, the application passes > a pointer to a callback function with the signature: > > -int hook_fn(PGauthData type, PGconn *conn, void *data); > +typedef int (*PQauthDataHook_type) (PGauthData type, PGconn *conn, void *data); > > which libpq will call when an action is > required of the application. type describes I looked at this, and I think using a typedef makes it too complicated. The idea is that "hook" should be a pointer to a function that has this definition. Maybe we should change it to: int hook(PGauthData type, PGconn *conn, void *data); ---- to match the line above: void PQsetAuthDataHook(PQauthDataHook_type hook); -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.