Re: [PATCH] Expose port->authn_id to extensions and triggers

From: Jacob Champion <jchampion(at)timescale(dot)com>
To: "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Joe Conway <mail(at)joeconway(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "sfrost(at)snowman(dot)net" <sfrost(at)snowman(dot)net>, "rjuju123(at)gmail(dot)com" <rjuju123(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>
Subject: Re: [PATCH] Expose port->authn_id to extensions and triggers
Date: 2022-08-16 16:58:28
Message-ID: CAAWbhmgJ-5YHyOO4ioa-q1bDRexiwMBFru6jJVmV+ShUx_0yeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 16, 2022 at 2:02 AM Drouvot, Bertrand <bdrouvot(at)amazon(dot)com> wrote:
> On 8/14/22 11:57 AM, Michael Paquier wrote:
> > One thing was itching me about the serialization and
> > deserialization logic though: could it be more readable if we used an
> > intermediate structure to store the length of the serialized strings?
> > We use this approach in other areas, like for the snapshot data in
> > snapmgr.c. This would handle the case of an empty and NULL string, by
> > storing -1 as length for NULL and >= 0 for the string length if there
> > is something set, while making the addition of more fields a
> > no-brainer.
>
> I think that's a good idea and I think that would be more readable (as
> compare to storing a "hint" in the first byte).

Sounds good. v3, attached, should make the requested changes:
- declare `struct ClientConnectionInfo`
- use an intermediate serialization struct
- switch to length-"prefixing" for the string

I do like the way this reads compared to before.

Thanks,
--Jacob

Attachment Content-Type Size
since-v2.diff.txt text/plain 4.5 KB
v3-0001-Allow-parallel-workers-to-read-authn_id.patch text/x-patch 12.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2022-08-16 17:04:26 Re: Column Filtering in Logical Replication
Previous Message Jacob Champion 2022-08-16 16:52:11 Re: SYSTEM_USER reserved word implementation