From 1d8549e22a76612f0a8aa12dcd2b5a101fcd335c Mon Sep 17 00:00:00 2001 From: Dean Rasheed Date: Wed, 11 Feb 2026 10:25:07 +0000 Subject: [PATCH] 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 Reviewed-by: Viktor Holmberg 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 5b7b91eaf97..2f8202122ed 100644 --- a/doc/src/sgml/ref/create_policy.sgml +++ b/doc/src/sgml/ref/create_policy.sgml @@ -294,7 +294,9 @@ CREATE POLICY name ON If an INSERT has an ON CONFLICT DO - NOTHING/UPDATE clause, SELECT + UPDATE clause, or an ON CONFLICT DO + NOTHING clause with an arbiter index or constraint + specification, then SELECT permissions are required on the relation, and the rows proposed for insertion are checked using the relation's SELECT policies. If a row proposed for insertion does not satisfy the @@ -540,7 +542,11 @@ CREATE POLICY name ON INSERT ... ON CONFLICT - Check new row  + Check new row  + + If an arbiter index or constraint is specified. + + Row proposed for insertion is checked regardless of whether or not a conflict occurs.