| From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: doc: Improve description of RLS policies applied by command type |
| Date: | 2025-11-13 12:08:04 |
| Message-ID: | E1vJW7Q-006OoT-0u@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
doc: Improve description of RLS policies applied by command type.
On the CREATE POLICY page, the "Policies Applied by Command Type"
table was missing MERGE ... THEN DELETE and some of the policies
applied during INSERT ... ON CONFLICT and MERGE. Fix that, and try to
improve readability by listing the various MERGE cases separately,
rather than together with INSERT/UPDATE/DELETE. Mention COPY ... TO
along with SELECT, since it behaves in the same way. In addition,
document which policy violations cause errors to be thrown, and which
just cause rows to be silently ignored.
Also, a paragraph above the table states that INSERT ... ON CONFLICT
DO UPDATE only checks the WITH CHECK expressions of INSERT policies
for rows appended to the relation by the INSERT path, which is
incorrect -- all rows proposed for insertion are checked, regardless
of whether they end up being inserted. Fix that, and also mention that
the same applies to INSERT ... ON CONFLICT DO NOTHING.
In addition, in various other places on that page, clarify how the
different types of policy are applied to different commands, and
whether or not errors are thrown when policy checks do not pass.
Backpatch to all supported versions. Prior to v17, MERGE did not
support RETURNING, and so MERGE ... THEN INSERT would never check new
rows against SELECT policies. Prior to v15, MERGE was not supported at
all.
Author: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Reviewed-by: Viktor Holmberg <v(at)viktorh(dot)net>
Reviewed-by: Jian He <jian(dot)universality(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7dc4fa91413d62c47f41043c0fce0be536f51e13
Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 203 ++++++++++++++++++++++++++++--------
1 file changed, 159 insertions(+), 44 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mircea Cadariu | 2025-11-13 12:26:19 | Re: pgsql: Drop unnamed portal immediately after execution to completion |
| Previous Message | Thomas Munro | 2025-11-13 10:12:37 | pgsql: Add some missing #include <limits.h>. |