From: Drouvot, Bertrand <bdrouvot@amazon.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Jacob Champion <jchampion@timescale.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joe Conway <mail@joeconway.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: SYSTEM_USER reserved word implementation
Date: Wed, 7 Sep 2022 16:46:06 +0200
Message-ID: <9dae37cb-abe0-a773-da74-3e2b62279d4c@amazon.com> (raw)
In-Reply-To: <Yxha7/s9z8qk/R1e@paquier.xyz>
References: <20220627173250.46lvecpvuunc7pf5@alvherre.pgsql>
<c2727e30-a3d3-465f-f253-bfff81611a21@amazon.com>
<24d638c7-16f6-afb9-c25c-6a29c169210e@amazon.com>
<CAAWbhmiPwGCevz_FS3rRK5fWQ8RiLW2bPVABzJVDxVWCuMFdmg@mail.gmail.com>
<8fe1752a-2e3d-4ee8-656c-0caf5d860b0e@amazon.com>
<db5f852b-7e22-7b25-a0f3-5b4a67cd5be9@amazon.com>
<YwWooBzPlfzncJea@paquier.xyz>
<1da0e60c-bd85-9f2d-2039-103055338b00@amazon.com>
<40b4e4d0-d034-ea19-3ec3-1557f498770f@amazon.com>
<YwgboqQUV1+Y/k6z@paquier.xyz>
<Yxha7/s9z8qk/R1e@paquier.xyz>
Hi,
On 9/7/22 10:48 AM, Michael Paquier wrote:
> On Fri, Aug 26, 2022 at 10:02:26AM +0900, Michael Paquier wrote:
>> 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.
> At the end, fine by me to keep this approach as that's more
> consistent. I have reviewed the patch,
Thanks for looking at it!
> and a few things caught my
> attention:
> - I think that we'd better switch InitializeSystemUser() to have two
> const char * as arguments for authn_id and an auth_method, so as there
> is no need to use tweaks with UserAuth or ClientConnectionInfo in
> miscadmin.h to bypass an inclusion of libpq-be.h or hba.h.
Good point, thanks! And there is no need to pass the whole
ClientConnectionInfo (should we add more fields to it in the future).
> - The OID of the new function should be in the range 8000-9999, as
> taught by unused_oids.
Thanks for pointing out!
My reasoning was to use one available OID close to the ones used for
session_user and current_user.
> - Environments where the code is built without krb5 support would skip
> the test where SYSTEM_USER should be not NULL when authenticated, so I
> have added a test for that with MD5 in src/test/authentication/.
Good point, thanks for the new test (as that would also not be tested
(once added) in the new peer TAP test [1] for platforms where peer
authentication is not supported).
> - Docs have been reworded, and I have applied an indentation.
Thanks, looks good to me.
> - No need to use 200k rows in the table used to force the parallel
> scan, as long as the costs are set.
Right.
>
> It is a bit late here, so I may have missed something. For now, how
> does the attached look to you?
+# Test SYSTEM_USER <> NULL with parallel workers.
Nit: What about "Test SYSTEM_USER get the correct value with parallel
workers" as that's what we are actually testing.
Except the Nit above, that looks all good to me.
[1]: https://commitfest.postgresql.org/39/3845/
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
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, alvherre@alvh.no-ip.org, tgl@sss.pgh.pa.us, mail@joeconway.com
Subject: Re: SYSTEM_USER reserved word implementation
In-Reply-To: <9dae37cb-abe0-a773-da74-3e2b62279d4c@amazon.com>
References: <20220627173250.46lvecpvuunc7pf5@alvherre.pgsql> <c2727e30-a3d3-465f-f253-bfff81611a21@amazon.com> <24d638c7-16f6-afb9-c25c-6a29c169210e@amazon.com> <CAAWbhmiPwGCevz_FS3rRK5fWQ8RiLW2bPVABzJVDxVWCuMFdmg@mail.gmail.com> <8fe1752a-2e3d-4ee8-656c-0caf5d860b0e@amazon.com> <db5f852b-7e22-7b25-a0f3-5b4a67cd5be9@amazon.com> <YwWooBzPlfzncJea@paquier.xyz> <1da0e60c-bd85-9f2d-2039-103055338b00@amazon.com> <40b4e4d0-d034-ea19-3ec3-1557f498770f@amazon.com> <YwgboqQUV1+Y/k6z@paquier.xyz> <Yxha7/s9z8qk/R1e@paquier.xyz> <9dae37cb-abe0-a773-da74-3e2b62279d4c@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