Re: Improve OAuth discovery logging

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Improve OAuth discovery logging
Date: 2026-03-16 07:10:16
Message-ID: 99C6E80B-8770-41C2-8084-BF3C7F389FFF@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 16 Mar 2026, at 11:24, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
>> I'm experimenting with an ereport(FATAL_CLIENT_ONLY) option, in the
>> same vein as WARNING_CLIENT_ONLY, to try to cover this.
>
> I attached v7 that uses that and removes the abandoned handling as it
> is no longer needed with it.
>
>> P.S. I would eventually like to record our undocumented SASL profile
>> in a test suite (he said, staring at pg-pytest)...
>
> That would be definitely useful, with the todo comment and this not
> being documented I thought that this is a proper way to handle the
> issue. Even a proper documentation about it would be a good starting
> point.
> <v7-0001-Improve-OAuth-discovery-logging.patch>

I've took a look into v7. FATAL_CLIENT_ONLY approach LGTM.
pg_stat_database.sessions_fatal seems to be still incremented, but, probably,
we can live with it. But also we can fix it.

Changes to send_message_to_server_log() seems unreachable to me.
I think is_log_level_output() returns false for FATAL_CLIENT_ONLY, so
edata->output_to_server is never set to true for this level, and these
functions are never called.

FATAL_CLIENT_ONLY = 23 sits between FATAL (22) and PANIC (24).
Consider swapping FATAL and FATAL_CLIENT_ONLY, so that code like this will
have more sense:
elevel = Max(elevel, errordata[i].elevel);

Does this assignment have an effect?
+ ctx->state = OAUTH_STATE_FINISHED;
+ ereport(FATAL_CLIENT_ONLY,

Thanks!

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-03-16 07:23:40 Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
Previous Message Lukas Fittl 2026-03-16 07:07:54 Re: EXPLAIN: showing ReadStream / prefetch stats