Re: [PATCH] Expose port->authn_id to extensions and triggers - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] Expose port->authn_id to extensions and triggers
Date
Msg-id YwNpWPCx63D8R8gG@paquier.xyz
Whole thread Raw
In response to Re: [PATCH] Expose port->authn_id to extensions and triggers  ("Drouvot, Bertrand" <bdrouvot@amazon.com>)
Responses Re: [PATCH] Expose port->authn_id to extensions and triggers
List pgsql-hackers
On Wed, Aug 17, 2022 at 09:53:45AM +0200, Drouvot, Bertrand wrote:
> Thanks for the new version!
>
> +       /* Copy authn_id into the space after the struct. */
> +       if (serialized.authn_id_len >= 0)
>
> Maybe remove the "." at the end of the comment? (to be consistent with the
> other comment just above)

When it comes to such things, I usually apply the rule of consistency
with the surroundings, which sounds right here.

> +       memcpy(&serialized, conninfo, sizeof(serialized));
> +       authn_id = conninfo + sizeof(serialized);
>
> Move "authn_id = conninfo + sizeof(serialized)" in the "if
> (serialized.authn_id_len >= 0)" below?

Makes sense, so as never have something pointing to an area should
should not look at.  This should just be used when we know that there
is going to be a string.

> + src/backend/utils/init/miscinit.c:RestoreClientConnectionInfo(char
> *conninfo)
> + src/include/miscadmin.h:extern void RestoreClientConnectionInfo(char
> *procinfo);
>
> conninfo in both to be consistent?

Yep.  Looks like a copy-pasto, seen from here.

By the way, I have looked at the patch, tweaked a couple of things
with comments and the style, but overval that's fine.  First, I have
intended to apply this stuff today but I have lacked the time to do
so.  I should be able to get this wrapped tomorrow, though.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Column Filtering in Logical Replication
Next
From: Aleksander Alekseev
Date:
Subject: [PATCH] ALTER TABLE ... SET STORAGE default