From: | "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add regular expression testing for user name mapping in the peer authentication TAP test |
Date: | 2022-10-15 05:54:30 |
Message-ID: | 0156c4e4-2497-e282-671d-e209d915e46d@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 10/15/22 5:11 AM, Michael Paquier wrote:
> On Fri, Oct 14, 2022 at 06:31:15PM +0200, Drouvot, Bertrand wrote:
>> while working on [1], I thought it could also be useful to add regular
>> expression testing for user name mapping in the peer authentication TAP
>> test.
>
> Good idea now that we have a bit more coverage in the authentication
> tests.
Thanks for looking at it!
>> +# Test with regular expression in user name map.
>> +my $last_system_user_char = substr($system_user, -1);
>
> This would attach to the regex the last character of the system user.
Right.
> I would perhaps have used more characters than that (-3?), as substr()
> with a negative number larger than the string given in input would
> give the entire string. That's a nit, though.
I don't have a strong opinion on this, so let's extract the last 3
characters. This is what v2 attached does.
>
>> +# The regular expression does not match.
>> +reset_pg_ident($node, 'mypeermap', '/^$', 'testmapuser');
>
> This matches only an empty string, my brain gets that right?
Right. Giving a second thought to the non matching case, I think I'd
prefer to concatenate the system_user to the system_user instead. This
is what v2 does.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
v2-0001-tap-peer-test-with-regexp.patch | text/plain | 3.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2022-10-15 06:00:58 | Re: ExecRTCheckPerms() and many prunable partitions |
Previous Message | Amit Langote | 2022-10-15 05:47:05 | Re: Eliminating SPI from RI triggers - take 2 |