Add pg_sequences view
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 18 Nov 2016 17:00:00 +0000 (12:00 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 18 Nov 2016 19:59:03 +0000 (14:59 -0500)
commit67dc4ccbb2e1c27da823eced66d9217a5652cbb0
treea761b8c65e08543c96680c1f0a26410b2f5bb93e
parent8f91f323b4feef0371cd3db51be3007e44abd5e8
Add pg_sequences view

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.

Reviewed-by: Andreas Karlsson <andreas@proxel.se>
doc/src/sgml/catalogs.sgml
src/backend/catalog/system_views.sql
src/backend/commands/sequence.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/commands/sequence.h
src/test/regress/expected/rules.out
src/test/regress/expected/sequence.out
src/test/regress/expected/sequence_1.out
src/test/regress/sql/sequence.sql