Add pg_sequences view

Enterprise / PostgreSQL - Peter Eisentraut [gmx.net] - 18 November 2016 13:59 UTC

Like pg_tables, pg_views, and others, this view contains information about sequences in a way that is independent of the system catalog layout but more comprehensive than the information schema.

To help implement the view, add a new internal function pg_sequence_last_value() to return the last value of a sequence. This is kept separate from pg_sequence_parameters() to separate querying run-time state from catalog-like information.

67dc4cc Add pg_sequences view
doc/src/sgml/catalogs.sgml | 97 ++++++++++++++++++++++++++++++
src/backend/catalog/system_views.sql | 17 ++++++
src/backend/commands/sequence.c | 49 ++++++++++++++-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 4 +-
src/include/commands/sequence.h | 1 +
src/test/regress/expected/rules.out | 14 +++++
src/test/regress/expected/sequence.out | 23 ++++++-
src/test/regress/expected/sequence_1.out | 23 ++++++-
src/test/regress/sql/sequence.sql | 13 +++-
10 files changed, 233 insertions(+), 10 deletions(-)

Upstream: git.postgresql.org


  • Share