1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Avoid permission failure in pg_sequences.last_value

Before, reading pg_sequences.last_value would fail unless the user had
appropriate sequence permissions, which would make the pg_sequences view
cumbersome to use.  Instead, return null instead of the real value when
there are no permissions.

From: Michael Paquier <michael.paquier@gmail.com>
Reported-by: Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>
This commit is contained in:
Peter Eisentraut
2017-02-06 15:17:27 -05:00
parent ad6af3fc42
commit ab82340a43
3 changed files with 13 additions and 3 deletions

View File

@ -9882,7 +9882,10 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
<entry></entry>
<entry>The last sequence value written to disk. If caching is used,
this value can be greater than the last value handed out from the
sequence. Null if the sequence has not been read from yet.</entry>
sequence. Null if the sequence has not been read from yet. Also, if
the current user does not have <literal>USAGE</literal>
or <literal>SELECT</literal> privilege on the sequence, the value is
null.</entry>
</row>
</tbody>
</tgroup>