postgres.git / summary / log / commit / refs

commit    dfc15bd3286dc7828c7666bfca06c76252305517
Author:   Dean Rasheed <dean.a.rasheed@gmail.com>
Date:     Wed Feb 11 10:25:06 2026 +0000
First released in: 14.22, 15.17, 16.13, 17.9, 18.3

    doc: Clarify RLS policies applied for ON CONFLICT DO NOTHING.
    
    On the CREATE POLICY page, the description of per-command policies
    stated that SELECT policies are applied when an INSERT has an ON
    CONFLICT DO NOTHING clause. However, that is only the case if it
    includes an arbiter clause, so clarify that.
    
    While at it, also clarify the comment in the regression tests that
    cover this.
    
    Author: Dean Rasheed <dean.a.rasheed@gmail.com>
    Reviewed-by: Viktor Holmberg <v@viktorh.net>
    Discussion: https://postgr.es/m/CAEZATCXGwMQ+x00YY9XYG46T0kCajH=21QaYL9Xatz0dLKii+g@mail.gmail.com
    Backpatch-through: 14


doc/src/sgml/ref/create_policy.sgml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/ref/create_policy.sgml b/doc/src/sgml/ref/create_policy.sgml index 42d43ad7bf4..9065ccb65f9 100644 --- a/doc/src/sgml/ref/create_policy.sgml +++ b/doc/src/sgml/ref/create_policy.sgml @@ -294,7 +294,9 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable </para> <para> If an <literal>INSERT</literal> has an <literal>ON CONFLICT DO - NOTHING/UPDATE</literal> clause, <literal>SELECT</literal> + UPDATE</literal> clause, or an <literal>ON CONFLICT DO + NOTHING</literal> clause with an arbiter index or constraint + specification, then <literal>SELECT</literal> permissions are required on the relation, and the rows proposed for insertion are checked using the relation's <literal>SELECT</literal> policies. If a row proposed for insertion does not satisfy the @@ -540,7 +542,11 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable <row> <entry><command>INSERT ... ON CONFLICT</command></entry> <entry> - Check new row&nbsp;<footnote id="rls-on-conflict-priv"> + Check new row&nbsp;<footnote> + <para> + If an arbiter index or constraint is specified. + </para> + </footnote><footnote id="rls-on-conflict-priv"> <para> Row proposed for insertion is checked regardless of whether or not a conflict occurs. [parent: 5a461dc4dbf7]