summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2016-11-18 12:00:00 -0500
committerPeter Eisentraut <peter_e@gmx.net>2016-11-18 14:59:03 -0500
commit67dc4ccbb2e1c27da823eced66d9217a5652cbb0 (patch)
treea761b8c65e08543c96680c1f0a26410b2f5bb93e /doc/src
parent8f91f323b4feef0371cd3db51be3007e44abd5e8 (diff)
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>
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml97
1 files changed, 97 insertions, 0 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index bac169a19e4..561e228558d 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7395,6 +7395,11 @@
</row>
<row>
+ <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
+ <entry>sequences</entry>
+ </row>
+
+ <row>
<entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
<entry>parameter settings</entry>
</row>
@@ -9135,6 +9140,98 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
</table>
</sect1>
+ <sect1 id="view-pg-sequences">
+ <title><structname>pg_sequences</structname></title>
+
+ <indexterm zone="view-pg-sequences">
+ <primary>pg_sequences</primary>
+ </indexterm>
+
+ <para>
+ The view <structname>pg_sequences</structname> provides access to
+ useful information about each sequence in the database.
+ </para>
+
+ <table>
+ <title><structname>pg_sequences</> Columns</title>
+
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Type</entry>
+ <entry>References</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><structfield>schemaname</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+ <entry>Name of schema containing sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>sequencename</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+ <entry>Name of sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>sequenceowner</structfield></entry>
+ <entry><type>name</type></entry>
+ <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
+ <entry>Name of sequence's owner</entry>
+ </row>
+ <row>
+ <entry><structfield>start_value</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <entry></entry>
+ <entry>Start value of the sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>min_value</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <entry></entry>
+ <entry>Minimum value of the sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>max_value</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <entry></entry>
+ <entry>Maximum value of the sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>increment_by</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <entry></entry>
+ <entry>Increment value of the sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>cycle</structfield></entry>
+ <entry><type>boolean</type></entry>
+ <entry></entry>
+ <entry>Whether the sequence cycles</entry>
+ </row>
+ <row>
+ <entry><structfield>cache_size</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <entry></entry>
+ <entry>Cache size of the sequence</entry>
+ </row>
+ <row>
+ <entry><structfield>last_value</structfield></entry>
+ <entry><type>bigint</type></entry>
+ <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>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect1>
+
<sect1 id="view-pg-settings">
<title><structname>pg_settings</structname></title>