pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Drouvot, Bertrand <bdrouvot@amazon.com>
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: Sun, 14 Aug 2022 18:57:40 +0900
Message-ID: <YvjHFPs2yEDiMLVU@paquier.xyz> (raw)
In-Reply-To: <127bd019-04f0-313c-551c-d949cdc4ad50@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>

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.  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.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (89+ messages)  latest in thread

Message-ID: <YvjHFPs2yEDiMLVU@paquier.xyz>
Permalink:  ../YvjHFPs2yEDiMLVU@paquier.xyz/
Also on:    postgresql.org/message-id/YvjHFPs2yEDiMLVU@paquier.xyz

 · 

reply

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: michael@paquier.xyz, bdrouvot@amazon.com, 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: <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>

* 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