Commit d460c7cc authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Document that sequences can also be extension configuration tables

From: Michael Paquier <michael.paquier@gmail.com>
parent 9603a325
...@@ -698,17 +698,21 @@ SET LOCAL search_path TO @extschema@; ...@@ -698,17 +698,21 @@ SET LOCAL search_path TO @extschema@;
<para> <para>
To solve this problem, an extension's script file can mark a table To solve this problem, an extension's script file can mark a table
it has created as a configuration table, which will cause or a sequence it has created as a configuration relation, which will
<application>pg_dump</> to include the table's contents (not its cause <application>pg_dump</> to include the table's or the sequence's
definition) in dumps. To do that, call the function contents (not its definition) in dumps. To do that, call the function
<function>pg_extension_config_dump(regclass, text)</> after creating the <function>pg_extension_config_dump(regclass, text)</> after creating the
table, for example table or the sequence, for example
<programlisting> <programlisting>
CREATE TABLE my_config (key text, value text); CREATE TABLE my_config (key text, value text);
CREATE SEQUENCE my_config_seq;
SELECT pg_catalog.pg_extension_config_dump('my_config', ''); SELECT pg_catalog.pg_extension_config_dump('my_config', '');
SELECT pg_catalog.pg_extension_config_dump('my_config_seq', '');
</programlisting> </programlisting>
Any number of tables can be marked this way. Any number of tables or sequences can be marked this way. Sequences
associated with <type>serial</> or <type>bigserial</> columns can
be marked as well.
</para> </para>
<para> <para>
...@@ -729,6 +733,11 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr ...@@ -729,6 +733,11 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr
in the rows created by the extension's script. in the rows created by the extension's script.
</para> </para>
<para>
For sequences, the second argument of <function>pg_extension_config_dump</>
has no effect.
</para>
<para> <para>
More complicated situations, such as initially-provided rows that might More complicated situations, such as initially-provided rows that might
be modified by users, can be handled by creating triggers on the be modified by users, can be handled by creating triggers on the
...@@ -753,6 +762,12 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr ...@@ -753,6 +762,12 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr
out but the dump will not be able to be restored directly and user out but the dump will not be able to be restored directly and user
intervention will be required. intervention will be required.
</para> </para>
<para>
Sequences associated with <type>serial</> or <type>bigserial</> columns
need to be directly marked to dump their state. Marking their parent
relation is not enough for this purpose.
</para>
</sect2> </sect2>
<sect2> <sect2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment