]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
doc: Clarify pg_get_sequence_data() privileges and NULL results
authorFujii Masao <fujii@postgresql.org>
Sat, 20 Jun 2026 09:20:58 +0000 (18:20 +0900)
committerFujii Masao <fujii@postgresql.org>
Sat, 20 Jun 2026 09:20:58 +0000 (18:20 +0900)
The documentation for pg_get_sequence_data() did not match the
function's behavior. It stated that either USAGE or SELECT privilege
was sufficient, but the function returns sequence data only when the
caller has SELECT privilege.

The documentation also did not explain that the function returns a row
containing all NULL values when sequence data cannot be returned, such
as when the sequence does not exist or the caller lacks the required
privilege.

Update the documentation to reflect the actual behavior, including the
required privilege and the result returned when sequence data is
unavailable.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Discussion: https://postgr.es/m/CAHGQGwGNTaXnBKUV510_P1KwhdbHT+kgZ4zU5njBHy7nCqdhzg@mail.gmail.com

doc/src/sgml/func/func-sequence.sgml

index 4a2a6dc9369d62dcdaa892aa1c427fc35f21511d..de266c36296cf2c1d376fa2d0fefaa0b6e7f0dbe 100644 (file)
@@ -163,12 +163,13 @@ SELECT setval('myseq', 42, false);    <lineannotation>Next <function>nextval</fu
         <structfield>is_called</structfield> indicates whether the sequence has
         been used. <structfield>page_lsn</structfield> is the LSN corresponding
         to the most recent WAL record that modified this sequence relation.
+        This function returns a row of NULL values if the sequence does not
+        exist or if the current user lacks privileges on it.
        </para>
        <para>
         This function is primarily intended for internal use by pg_dump and by
         logical replication to synchronize sequences. It requires
-        <literal>USAGE</literal> or <literal>SELECT</literal> privilege on the
-        sequence.
+        <literal>SELECT</literal> privilege on the sequence.
        </para></entry>
       </row>
      </tbody>