Re: [oauth] Per connection auth hooks in libpq - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: [oauth] Per connection auth hooks in libpq
Date
Msg-id CAOYmi+kFyv3L954iszc3a8z1MZKDDEha4-Dw=SE-rVcN_K4nFg@mail.gmail.com
Whole thread
In response to [oauth] Per connection auth hooks in libpq  (Andreas Karlsson <andreas@proxel.se>)
List pgsql-hackers
On Thu, Feb 26, 2026 at 3:36 PM Andreas Karlsson <andreas@proxel.se> wrote:
> - https://github.com/ged/ruby-pg/pull/693
> - https://github.com/ged/ruby-pg/pull/700

Related, but a bit tangential: neither proposal there implements
cooperative use of the authdata hook, which is going to make your
problems worse. In particular,

> /* TODO: a hook can return 1, 0 or -1 */

is wrong. Zero is reserved for the implementation [1]; you want to
defer to the next link in the chain instead. It's up to the top-level
application (or else, something with *sole* threadsafe control of
libpq) to decide what that chain looks like.

--Jacob

[1] https://www.postgresql.org/docs/current/libpq-oauth.html#LIBPQ-PQSETAUTHDATAHOOK



pgsql-hackers by date:

Previous
From: Maxim Orlov
Date:
Subject: Re: Rework SLRU I/O errors handle
Next
From: Andrew Dunstan
Date:
Subject: Re: Allow specifying NULL default in pg_proc.dat for "any" arguments