pgsql: Introduce pg_sequence_read_tuple().

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Introduce pg_sequence_read_tuple().
Date: 2024-07-31 15:13:58
Message-ID: E1sZB1a-0023GY-0w@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Introduce pg_sequence_read_tuple().

This new function returns the data for the given sequence, i.e.,
the values within the sequence tuple. Since this function is a
substitute for SELECT from the sequence, the SELECT privilege is
required on the sequence in question. It returns all NULLs for
sequences for which we lack privileges, other sessions' temporary
sequences, and unlogged sequences on standbys.

This function is primarily intended for use by pg_dump in a
follow-up commit that will use it to optimize dumpSequenceData().
Like pg_sequence_last_value(), which is a support function for the
pg_sequences system view, pg_sequence_read_tuple() is left
undocumented.

Bumps catversion.

Reviewed-by: Michael Paquier, Tom Lane
Discussion: https://postgr.es/m/20240503025140.GA1227404%40nathanxps13

Branch
------
master

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

Modified Files
--------------
src/backend/commands/sequence.c | 61 ++++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 6 ++++
src/test/regress/expected/sequence.out | 7 ++++
src/test/regress/sql/sequence.sql | 3 ++
5 files changed, 78 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-07-31 22:54:29 pgsql: Allow parallel workers to cope with a newly-created session user
Previous Message Nathan Bossart 2024-07-31 15:13:57 pgsql: Parse sequence type and integer metadata in dumpSequence().