Re: [oauth] Per connection auth hooks in libpq

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Andreas Karlsson <andreas(at)proxel(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [oauth] Per connection auth hooks in libpq
Date: 2026-03-06 17:10:37
Message-ID: CAOYmi+kFyv3L954iszc3a8z1MZKDDEha4-Dw=SE-rVcN_K4nFg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 26, 2026 at 3:36 PM Andreas Karlsson <andreas(at)proxel(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-03-06 17:34:24 Re: Allow specifying NULL default in pg_proc.dat for "any" arguments
Previous Message Maxim Orlov 2026-03-06 17:08:15 Re: Rework SLRU I/O errors handle