From: Drouvot, Bertrand <bdrouvot@amazon.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Jacob Champion <jchampion@timescale.com>
Cc: Joe Conway <mail@joeconway.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: sfrost@snowman.net <sfrost@snowman.net>
Cc: rjuju123@gmail.com <rjuju123@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: andres@anarazel.de <andres@anarazel.de>
Subject: Re: [PATCH] Expose port->authn_id to extensions and triggers
Date: Tue, 16 Aug 2022 11:02:30 +0200
Message-ID: <520bd3ce-334b-b9c2-2130-858fb04ce56f@amazon.com> (raw)
In-Reply-To: <YvjHFPs2yEDiMLVU@paquier.xyz>
References: <Yu4JhEvh1V0sGWXv@paquier.xyz>
<af85ae52-de60-6a98-d69e-7d410aee752d@joeconway.com>
<Yu9slCBp0WWD4Qx1@paquier.xyz>
<d25a412e-9686-d37f-3bd1-63b821f67a51@amazon.com>
<YvImQ0sl1dV4TBNg@paquier.xyz>
<34308245-ea21-82ee-b1fd-00b4766f3527@amazon.com>
<CAAWbhmi4OHmk0EVBuQrYcwbotF8uFayDVgkL-H-gqrK0XmeSeg@mail.gmail.com>
<2a1e2717-8c68-3f9e-1e02-32da71deb327@amazon.com>
<CAAWbhmiRZMBLCKjJV43skOxiBM71P82O2KMJf-n97t4zUtdqDw@mail.gmail.com>
<127bd019-04f0-313c-551c-d949cdc4ad50@amazon.com>
<YvjHFPs2yEDiMLVU@paquier.xyz>
Hi,
On 8/14/22 11:57 AM, Michael Paquier wrote:
> On Fri, Aug 12, 2022 at 03:34:04PM +0200, Drouvot, Bertrand wrote:
>> 3)
>>
>> +SerializeClientConnectionInfo(Size maxsize, char *start_address)
>> +{
>> + /*
>> + * First byte is an indication of whether or not authn_id has been
>> set to
>> + * non-NULL, to differentiate that case from the empty string.
>> + */
>>
>> is authn_id being an empty string possible?
> I don't recall that this can be the case yet, but we cannot discard
> it.
Fair point.
> 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).
Regards,
--
Bertrand Drouvot
Amazon Web Services: https://aws.amazon.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: bdrouvot@amazon.com, michael@paquier.xyz, jchampion@timescale.com, mail@joeconway.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, sfrost@snowman.net, rjuju123@gmail.com, andres@anarazel.de
Subject: Re: [PATCH] Expose port->authn_id to extensions and triggers
In-Reply-To: <520bd3ce-334b-b9c2-2130-858fb04ce56f@amazon.com>
References: <Yu4JhEvh1V0sGWXv@paquier.xyz> <af85ae52-de60-6a98-d69e-7d410aee752d@joeconway.com> <Yu9slCBp0WWD4Qx1@paquier.xyz> <d25a412e-9686-d37f-3bd1-63b821f67a51@amazon.com> <YvImQ0sl1dV4TBNg@paquier.xyz> <34308245-ea21-82ee-b1fd-00b4766f3527@amazon.com> <CAAWbhmi4OHmk0EVBuQrYcwbotF8uFayDVgkL-H-gqrK0XmeSeg@mail.gmail.com> <2a1e2717-8c68-3f9e-1e02-32da71deb327@amazon.com> <CAAWbhmiRZMBLCKjJV43skOxiBM71P82O2KMJf-n97t4zUtdqDw@mail.gmail.com> <127bd019-04f0-313c-551c-d949cdc4ad50@amazon.com> <YvjHFPs2yEDiMLVU@paquier.xyz> <520bd3ce-334b-b9c2-2130-858fb04ce56f@amazon.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox