From 0beda36f7daab693d243a344b87c0c1362cbf535 Mon Sep 17 00:00:00 2001
From: "Paul A. Jungwirth" <pj@illuminatedcomputing.com>
Date: Thu, 3 Sep 2026 12:55:21 -0700
Subject: [PATCH v1] Document the privileges FOR PORTION OF needs on the range
 column

Since UPDATE FOR PORTION OF implicitly updates the application-time column, and
since UPDATE/DELETE FOR PORTION OF implicitly reads it, we should mention that
UPDATE and/or SELECT permissions are needed for that column when doing an
UPDATE/DELETE.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Backpatch-through: 19
---
 doc/src/sgml/ref/delete.sgml | 5 ++++-
 doc/src/sgml/ref/update.sgml | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index 3ab1f60525a..eac221ae292 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -94,7 +94,10 @@ DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
    privilege for any table in the <literal>USING</literal> clause or
    whose values are read in the <replaceable
    class="parameter">condition</replaceable>.
-   When <literal>FOR PORTION OF</literal> is used, the secondary inserts do
+   When <literal>FOR PORTION OF</literal> is used, you must also have the
+   <literal>SELECT</literal> privilege on the
+   <replaceable class="parameter">range_column_name</replaceable> column.
+   The secondary inserts, however, do
    not require <literal>INSERT</literal> privilege on the table.  (This is
    because conceptually no new information is being added; the inserted rows
    only preserve existing data about the untargeted time period.)  Row-level
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index 3175671d475..179b4ae1bfc 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -98,7 +98,10 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
    privilege on any column whose values are read in the
    <replaceable class="parameter">expressions</replaceable> or
    <replaceable class="parameter">condition</replaceable>.
-   When <literal>FOR PORTION OF</literal> is used, the secondary inserts do
+   When <literal>FOR PORTION OF</literal> is used, you must also have the
+   <literal>SELECT</literal> and <literal>UPDATE</literal> privileges on the
+   <replaceable class="parameter">range_column_name</replaceable> column.
+   The secondary inserts, however, do
    not require <literal>INSERT</literal> privilege on the table.  (This is
    because conceptually no new information is being added; the inserted rows
    only preserve existing data about the untargeted time period.)  Row-level
-- 
2.47.3

