From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Viktor Holmberg <v(at)viktorh(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Docs and tests for RLS policies applied by command type |
Date: | 2025-10-23 15:14:56 |
Message-ID: | CAEZATCWKAH2uDt7WAqY6we+Ux=Y--iHn6JQozO7nd_sutNz0Nw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 23 Oct 2025 at 09:23, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Tue, Oct 21, 2025 at 12:01 AM Viktor Holmberg <v(at)viktorh(dot)net> wrote:
> >
> > So patch 0001, attached, adds a new set of regression tests, near the
> > start of rowsecurity.sql, which specifically tests which policies are
> > applied for each command variant.
> >
> hi.
> I only applied the 0001.
>
> it would be better to add some comments to the regress tests, IMHO.
> for example, for below:
> +SELECT * FROM rls_test_src FOR UPDATE;
> +SELECT * FROM rls_test_src FOR NO KEY UPDATE;
> +SELECT * FROM rls_test_src FOR SHARE;
> +SELECT * FROM rls_test_src FOR KEY SHARE;
>
> we could add a comment such as:
> "Expect both UPDATE and the SELECT command policies to be invoked for
> these four below query".
Thank you both for the reviews.
Attached is a new version with more comments in the tests, focusing on
what is expected from each test.
> The 0001 regess tests define several functions: sel_using_fn,
> ins_check_fn, upd_using_fn,
> upd_check_fn, and del_using_fn.
> IMHO, these could be simplified (we probably only need two functions).
Good point. Actually it can be done with just one function, further
reducing the amount of test code.
A recent commit reminded me that COPY ... TO also applies RLS SELECT
policies (and so does TABLE, though I doubt many people use that), so
I think it's worth testing and documenting those too. Updated patches
attached.
Regards,
Dean
Attachment | Content-Type | Size |
---|---|---|
v2-0001-New-RLS-tests-to-test-policies-applied-by-command.patch | application/x-patch | 18.9 KB |
v2-0002-doc-Improve-the-Policies-Applied-by-Command-Type-.patch | application/x-patch | 5.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2025-10-23 15:17:06 | Re: Git clone over git protocol fails |
Previous Message | Peter Geoghegan | 2025-10-23 15:14:18 | Re: CI: Add task that runs pgindent |