Re: SYSTEM_USER reserved word implementation - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: SYSTEM_USER reserved word implementation
Date
Msg-id YwgboqQUV1+Y/k6z@paquier.xyz
Whole thread Raw
In response to Re: SYSTEM_USER reserved word implementation  ("Drouvot, Bertrand" <bdrouvot@amazon.com>)
Responses Re: SYSTEM_USER reserved word implementation
Re: SYSTEM_USER reserved word implementation
List pgsql-hackers
On Thu, Aug 25, 2022 at 08:21:05PM +0200, Drouvot, Bertrand wrote:
> system_user() now returns a text and I moved it to miscinit.c in the new
> version attached (I think it makes more sense now).

+/* kluge to avoid including libpq/libpq-be.h here */
+struct ClientConnectionInfo;
+extern void InitializeSystemUser(struct ClientConnectionInfo conninfo);
+extern const char* GetSystemUser(void);

FWIW, I was also wondering about the need for all this initialization
stanza and the extra SystemUser in TopMemoryContext.  Now that we have
MyClientConnectionInfo, I was thinking to just build the string in the
SQL function as that's the only code path that needs to know about
it.  True that this approach saves some extra palloc() calls each time
the function is called.

> New version attached is also addressing Michael's remark regarding the peer
> authentication TAP test.

Thanks.  I've wanted some basic tests for the peer authentication for
some time now, independently on this thread, so it would make sense to
split that into a first patch and stress the buildfarm to see what
happens, then add these tests for SYSTEM_USER on top of the new test.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_receivewal and SIGTERM
Next
From: Shinya Kato
Date:
Subject: Fix japanese translation of log messages