Skip to content

Commit 33b883d

Browse files
committed
seqam v9
1 parent f954254 commit 33b883d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2635
-599
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@
248248
<entry>security labels on database objects</entry>
249249
</row>
250250

251+
<row>
252+
<entry><link linkend="catalog-pg-seqam"><structname>pg_seqam</structname></link></entry>
253+
<entry>sequence access methods</entry>
254+
</row>
255+
251256
<row>
252257
<entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
253258
<entry>dependencies on shared objects</entry>
@@ -5536,6 +5541,95 @@
55365541
</table>
55375542
</sect1>
55385543

5544+
<sect1 id="catalog-pg-seqam">
5545+
<title><structname>pg_seqam</structname></title>
5546+
5547+
<indexterm zone="catalog-pg-seqam">
5548+
<primary>pg_seqam</primary>
5549+
</indexterm>
5550+
5551+
<para>
5552+
The catalog <structname>pg_seqam</structname> stores information about
5553+
sequence access methods. There is one row for each sequence access method
5554+
installed on the system.
5555+
</para>
5556+
5557+
<table>
5558+
<title><structname>pg_seqam</> Columns</title>
5559+
5560+
<tgroup cols="4">
5561+
<thead>
5562+
<row>
5563+
<entry>Name</entry>
5564+
<entry>Type</entry>
5565+
<entry>References</entry>
5566+
<entry>Description</entry>
5567+
</row>
5568+
</thead>
5569+
<tbody>
5570+
5571+
<row>
5572+
<entry><structfield>oid</structfield></entry>
5573+
<entry><type>oid</type></entry>
5574+
<entry></entry>
5575+
<entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5576+
</row>
5577+
5578+
<row>
5579+
<entry><structfield>seqamname</structfield></entry>
5580+
<entry><type>name</type></entry>
5581+
<entry></entry>
5582+
<entry>Name of the access method</entry>
5583+
</row>
5584+
5585+
<row>
5586+
<entry><structfield>seqamreloptions</structfield></entry>
5587+
<entry><type>regproc</type></entry>
5588+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5589+
<entry>Function to parse and validate <structfield>reloptions</> for the access method</entry>
5590+
</row>
5591+
5592+
<row>
5593+
<entry><structfield>seqaminit</structfield></entry>
5594+
<entry><type>regproc</type></entry>
5595+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5596+
<entry>Function called during initialization or <command>RESET</command> of a sequence</entry>
5597+
</row>
5598+
5599+
<row>
5600+
<entry><structfield>seqamalloc</structfield></entry>
5601+
<entry><type>regproc</type></entry>
5602+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5603+
<entry><quote>Allocate new sequence id</quote> function</entry>
5604+
</row>
5605+
5606+
<row>
5607+
<entry><structfield>seqamsetval</structfield></entry>
5608+
<entry><type>regproc</type></entry>
5609+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5610+
<entry>Function implementing <function>setval()</function> interface</entry>
5611+
</row>
5612+
5613+
<row>
5614+
<entry><structfield>seqamgetstate</structfield></entry>
5615+
<entry><type>regproc</type></entry>
5616+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5617+
<entry>Function to dump current state of a sequence (used mainly by pg_dump)</entry>
5618+
</row>
5619+
5620+
<row>
5621+
<entry><structfield>seqamsetstate</structfield></entry>
5622+
<entry><type>regproc</type></entry>
5623+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5624+
<entry>Function to restore a dumped state of a sequence (used mainly by pg_dump)</entry>
5625+
</row>
5626+
5627+
</tbody>
5628+
</tgroup>
5629+
</table>
5630+
5631+
</sect1>
5632+
55395633
<sect1 id="catalog-pg-shdepend">
55405634
<title><structname>pg_shdepend</structname></title>
55415635

doc/src/sgml/config.sgml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5671,6 +5671,27 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
56715671
</listitem>
56725672
</varlistentry>
56735673

5674+
<varlistentry id="guc-serial-sequenceam" xreflabel="serial_sequenceam">
5675+
<term><varname>serial_sequenceam</varname> (<type>string</type>)
5676+
<indexterm>
5677+
<primary><varname>serial_sequenceam</> configuration parameter</primary>
5678+
</indexterm>
5679+
<indexterm><primary>sequence access method</><secondary>serial</></>
5680+
</term>
5681+
<listitem>
5682+
<para>
5683+
This variable specifies the default sequence access method to be used
5684+
for <type>SERIAL</> and <type>BIGSERIAL</>.
5685+
</para>
5686+
5687+
<para>
5688+
The default is 'local' sequence access method. If the value does not
5689+
match the name of any existing sequence access method, an error will be
5690+
raised.
5691+
</para>
5692+
</listitem>
5693+
</varlistentry>
5694+
56745695
<varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
56755696
<term><varname>check_function_bodies</varname> (<type>boolean</type>)
56765697
<indexterm>

doc/src/sgml/filelist.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<!ENTITY brin SYSTEM "brin.sgml">
9191
<!ENTITY planstats SYSTEM "planstats.sgml">
9292
<!ENTITY indexam SYSTEM "indexam.sgml">
93+
<!ENTITY seqam SYSTEM "seqam.sgml">
9394
<!ENTITY nls SYSTEM "nls.sgml">
9495
<!ENTITY plhandler SYSTEM "plhandler.sgml">
9596
<!ENTITY fdwhandler SYSTEM "fdwhandler.sgml">

doc/src/sgml/postgres.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
&spgist;
250250
&gin;
251251
&brin;
252+
&seqam;
252253
&storage;
253254
&bki;
254255
&planstats;

doc/src/sgml/ref/alter_sequence.sgml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [
2929
[ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ]
3030
[ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
3131
[ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
32+
[ USING <replaceable class="parameter">access_method</replaceable> [ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ] ]
3233
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="PARAMETER">new_owner</replaceable> | CURRENT_USER | SESSION_USER }
3334
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
3435
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
36+
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="PARAMETER">action</replaceable> [, ... ]
37+
38+
<phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase>
39+
SET ( <replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] )
40+
RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ] )
3541
</synopsis>
3642
</refsynopsisdiv>
3743

@@ -220,6 +226,24 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
220226
</listitem>
221227
</varlistentry>
222228

229+
<varlistentry>
230+
<term><literal>USING</literal> <replaceable class="parameter">access_method</replaceable></term>
231+
<listitem>
232+
<para>
233+
The <literal>USING</literal> option specifies which sequence access
234+
method will be used when generating the sequence numbers.
235+
</para>
236+
<para>
237+
When the <literal>RESTART WITH <replaceable
238+
class="parameter">restart</replaceable></literal> parameter is also
239+
given, it will be used as a starting value for the new access method.
240+
Otherwise the <function>nextval</> function will be called with the old
241+
access method and the result will be used as start value for the new
242+
access method.
243+
</para>
244+
</listitem>
245+
</varlistentry>
246+
223247
<varlistentry>
224248
<term><replaceable class="PARAMETER">new_owner</replaceable></term>
225249
<listitem>
@@ -247,6 +271,37 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
247271
</listitem>
248272
</varlistentry>
249273

274+
<varlistentry>
275+
<term><literal>SET ( <replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] )</literal></term>
276+
<listitem>
277+
<para>
278+
This clause changes one or more storage parameters for the sequence
279+
access method.
280+
</para>
281+
282+
</listitem>
283+
</varlistentry>
284+
285+
<varlistentry>
286+
<term><literal>RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ] )</literal></term>
287+
<listitem>
288+
<para>
289+
This clause resets one or more storage parameters to their defaults.
290+
</para>
291+
</listitem>
292+
</varlistentry>
293+
294+
<varlistentry>
295+
<term><literal>WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] )</literal></term>
296+
<listitem>
297+
<para>
298+
This clause specifies optional storage parameters for the new sequence
299+
access method.
300+
</para>
301+
302+
</listitem>
303+
</varlistentry>
304+
250305
</variablelist>
251306
</para>
252307
</refsect1>

doc/src/sgml/ref/create_sequence.sgml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] <replaceable class="param
2525
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ]
2626
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
2727
[ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
28+
[ USING <replaceable class="parameter">access_method</replaceable> ]
29+
[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ]
2830
</synopsis>
2931
</refsynopsisdiv>
3032

@@ -223,6 +225,29 @@ SELECT * FROM <replaceable>name</replaceable>;
223225
</para>
224226
</listitem>
225227
</varlistentry>
228+
229+
<varlistentry>
230+
<term><literal>USING</literal> <replaceable class="parameter">access_method</replaceable></term>
231+
<listitem>
232+
<para>
233+
The <literal>USING</literal> option specifies which sequence access
234+
method will be used when generating the sequence numbers. The default
235+
is <literal>"local"</>.
236+
</para>
237+
</listitem>
238+
</varlistentry>
239+
240+
<varlistentry>
241+
<term><literal>WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] )</literal></term>
242+
<listitem>
243+
<para>
244+
This clause specifies optional storage parameters for a sequence access
245+
method.
246+
</para>
247+
248+
</listitem>
249+
</varlistentry>
250+
226251
</variablelist>
227252
</refsect1>
228253

0 commit comments

Comments
 (0)