pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: doc: Improve description of RLS policies applied by command type
6+ messages / 1 participants
[nested] [flat]

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/749f4ce4d9845b01ab2db6632ccd6610386dcd9e

Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 203 ++++++++++++++++++++++++++++--------
1 file changed, 159 insertions(+), 44 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d60dabfe2507cb8822c739064264e12e12caccf7

Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 203 ++++++++++++++++++++++++++++--------
1 file changed, 159 insertions(+), 44 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8d43607cd4223c3ff48d87ced11780c8508d26c8

Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 205 ++++++++++++++++++++++++++++--------
1 file changed, 159 insertions(+), 46 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c663152adcec438c72173e15021b94f54fa618fe

Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 205 ++++++++++++++++++++++++++++--------
1 file changed, 159 insertions(+), 46 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: doc: Improve description of RLS policies applied by command type
@ 2025-11-13 12:08 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2025-11-13 12:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7aa83ea57845e5ba2af3d1ee869a99e8250c5b3e

Modified Files
--------------
doc/src/sgml/ref/create_policy.sgml | 141 ++++++++++++++++++++++++++----------
1 file changed, 102 insertions(+), 39 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2025-11-13 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>
2025-11-13 12:08 pgsql: doc: Improve description of RLS policies applied by command type Dean Rasheed <dean.a.rasheed@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox