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
signature.asc
Description: PGP signature