Add XML ID attributes to create_publication.sgml.

This commit adds XML ID attributes to all varlistentries in
create_publication.sgml. This allows us to include links to refer to
publication options, making documents more readable.

Author: Kuroda Hayato
Reviewed-by: Peter Smith, Amit Kapila
Discussion: https://postgr.es/m/TYAPR01MB58668219FEA4EC231486A433F58E9@TYAPR01MB5866.jpnprd01.prod.outlook.com
This commit is contained in:
Amit Kapila 2023-03-31 08:59:55 +05:30
parent f95c1cd6b2
commit ed94e8563e
5 changed files with 68 additions and 51 deletions

View File

@ -367,7 +367,8 @@ INSERT 0 3
<para> <para>
Create publications for the tables. The publications <literal>pub2</literal> Create publications for the tables. The publications <literal>pub2</literal>
and <literal>pub3a</literal> disallow some <literal>publish</literal> and <literal>pub3a</literal> disallow some
<link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
operations. The publication <literal>pub3b</literal> has a row filter (see operations. The publication <literal>pub3b</literal> has a row filter (see
<xref linkend="logical-replication-row-filter"/>). <xref linkend="logical-replication-row-filter"/>).
<programlisting> <programlisting>
@ -801,11 +802,12 @@ ALTER SUBSCRIPTION
<para> <para>
If the publication contains a partitioned table, the publication parameter If the publication contains a partitioned table, the publication parameter
<literal>publish_via_partition_root</literal> determines which row filter <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
is used. If <literal>publish_via_partition_root</literal> is <literal>true</literal>, determines which row filter is used. If <literal>publish_via_partition_root</literal>
the <emphasis>root partitioned table's</emphasis> row filter is used. Otherwise, is <literal>true</literal>, the <emphasis>root partitioned table's</emphasis>
if <literal>publish_via_partition_root</literal> is <literal>false</literal> row filter is used. Otherwise, if <literal>publish_via_partition_root</literal>
(default), each <emphasis>partition's</emphasis> row filter is used. is <literal>false</literal> (default), each <emphasis>partition's</emphasis>
row filter is used.
</para> </para>
</sect2> </sect2>
@ -829,8 +831,9 @@ ALTER SUBSCRIPTION
<warning> <warning>
<para> <para>
Because initial data synchronization does not take into account the Because initial data synchronization does not take into account the
<literal>publish</literal> parameter when copying existing table data, <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
some rows may be copied that would not be replicated using DML. Refer to parameter when copying existing table data, some rows may be copied that
would not be replicated using DML. Refer to
<xref linkend="logical-replication-snapshot"/>, and see <xref linkend="logical-replication-snapshot"/>, and see
<xref linkend="logical-replication-subscription-examples"/> for examples. <xref linkend="logical-replication-subscription-examples"/> for examples.
</para> </para>
@ -851,7 +854,8 @@ ALTER SUBSCRIPTION
<para> <para>
If the subscription has several publications in which the same table has If the subscription has several publications in which the same table has
been published with different row filters (for the same <literal>publish</literal> been published with different row filters (for the same
<link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
operation), those expressions get ORed together, so that rows satisfying operation), those expressions get ORed together, so that rows satisfying
<emphasis>any</emphasis> of the expressions will be replicated. This means all <emphasis>any</emphasis> of the expressions will be replicated. This means all
the other row filters for the same table become redundant if: the other row filters for the same table become redundant if:
@ -863,15 +867,17 @@ ALTER SUBSCRIPTION
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
One of the publications was created using <literal>FOR ALL TABLES</literal>. One of the publications was created using
<link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>.
This clause does not allow row filters. This clause does not allow row filters.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
One of the publications was created using One of the publications was created using
<literal>FOR TABLES IN SCHEMA</literal> and the table belongs to <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
the referred schema. This clause does not allow row filters. and the table belongs to the referred schema. This clause does not allow
row filters.
</para> </para>
</listitem> </listitem>
</itemizedlist></para> </itemizedlist></para>
@ -1136,9 +1142,9 @@ test_sub=# SELECT * FROM t1;
<para> <para>
The following examples show how the publication parameter The following examples show how the publication parameter
<literal>publish_via_partition_root</literal> determines whether the row <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
filter of the parent or child table will be used in the case of partitioned determines whether the row filter of the parent or child table will be used
tables. in the case of partitioned tables.
</para> </para>
<para> <para>
@ -1291,15 +1297,16 @@ test_sub=# SELECT * FROM child ORDER BY a;
<para> <para>
Specifying a column list when the publication also publishes Specifying a column list when the publication also publishes
<literal>FOR TABLES IN SCHEMA</literal> is not supported. <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
is not supported.
</para> </para>
<para> <para>
For partitioned tables, the publication parameter For partitioned tables, the publication parameter
<literal>publish_via_partition_root</literal> determines which column list <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
is used. If <literal>publish_via_partition_root</literal> is determines which column list is used. If <literal>publish_via_partition_root</literal>
<literal>true</literal>, the root partitioned table's column list is used. is <literal>true</literal>, the root partitioned table's column list is
Otherwise, if <literal>publish_via_partition_root</literal> is used. Otherwise, if <literal>publish_via_partition_root</literal> is
<literal>false</literal> (the default), each partition's column list is used. <literal>false</literal> (the default), each partition's column list is used.
</para> </para>
@ -1610,7 +1617,9 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
tables.) Publications can also specify that changes are to be replicated tables.) Publications can also specify that changes are to be replicated
using the identity and schema of the partitioned root table instead of using the identity and schema of the partitioned root table instead of
that of the individual leaf partitions in which the changes actually that of the individual leaf partitions in which the changes actually
originate (see <link linkend="sql-createpublication"><command>CREATE PUBLICATION</command></link>). originate (see
<link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
parameter of <command>CREATE PUBLICATION</command>).
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@ -1676,9 +1685,11 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
</para> </para>
<note> <note>
<para> <para>
The publication <literal>publish</literal> parameter only affects what The publication
DML operations will be replicated. The initial data synchronization does <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
not take this parameter into account when copying the existing table data. parameter only affects what DML operations will be replicated. The
initial data synchronization does not take this parameter into account
when copying the existing table data.
</para> </para>
</note> </note>
</sect2> </sect2>
@ -1724,10 +1735,11 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
and <literal>TRIGGER</literal> privilege on such tables to trusted roles. and <literal>TRIGGER</literal> privilege on such tables to trusted roles.
Moreover, if untrusted users can create tables, use only Moreover, if untrusted users can create tables, use only
publications that list tables explicitly. That is to say, create a publications that list tables explicitly. That is to say, create a
subscription <literal>FOR ALL TABLES</literal> or subscription
<literal>FOR TABLES IN SCHEMA</literal> only when superusers trust <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
every user permitted to create a non-temp table on the publisher or the or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
subscriber. only when superusers trust every user permitted to create a non-temp table
on the publisher or the subscriber.
</para> </para>
<para> <para>

View File

@ -54,7 +54,8 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
subscribing side in order to become effective. Note also that subscribing side in order to become effective. Note also that
<literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables <literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
that were specified using <literal>FOR TABLE</literal>/ that were specified using
<link linkend="sql-createpublication-for-table"><literal>FOR TABLE</literal></link>/
<literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal> <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
with a <literal>WHERE</literal> clause is not allowed. with a <literal>WHERE</literal> clause is not allowed.
</para> </para>
@ -79,8 +80,9 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
To alter the owner, you must be able to <literal>SET ROLE</literal> to the To alter the owner, you must be able to <literal>SET ROLE</literal> to the
new owning role, and that role must have <literal>CREATE</literal> new owning role, and that role must have <literal>CREATE</literal>
privilege on the database. privilege on the database.
Also, the new owner of a <literal>FOR ALL TABLES</literal> or Also, the new owner of a
<literal>FOR TABLES IN SCHEMA</literal> <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
publication must be a superuser. However, a superuser can publication must be a superuser. However, a superuser can
change the ownership of a publication regardless of these restrictions. change the ownership of a publication regardless of these restrictions.
</para> </para>

View File

@ -54,7 +54,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
<title>Parameters</title> <title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry id="sql-createpublication-name">
<term><replaceable class="parameter">name</replaceable></term> <term><replaceable class="parameter">name</replaceable></term>
<listitem> <listitem>
<para> <para>
@ -63,7 +63,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="sql-createpublication-for-table">
<term><literal>FOR TABLE</literal></term> <term><literal>FOR TABLE</literal></term>
<listitem> <listitem>
<para> <para>
@ -117,7 +117,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="sql-createpublication-for-all-tables">
<term><literal>FOR ALL TABLES</literal></term> <term><literal>FOR ALL TABLES</literal></term>
<listitem> <listitem>
<para> <para>
@ -127,7 +127,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="sql-createpublication-for-tables-in-schema">
<term><literal>FOR TABLES IN SCHEMA</literal></term> <term><literal>FOR TABLES IN SCHEMA</literal></term>
<listitem> <listitem>
<para> <para>
@ -158,7 +158,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="sql-createpublication-with">
<term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term> <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
<listitem> <listitem>
<para> <para>
@ -166,7 +166,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
following parameters are supported: following parameters are supported:
<variablelist> <variablelist>
<varlistentry> <varlistentry id="sql-createpublication-with-publish">
<term><literal>publish</literal> (<type>string</type>)</term> <term><literal>publish</literal> (<type>string</type>)</term>
<listitem> <listitem>
<para> <para>
@ -188,7 +188,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry id="sql-createpublication-with-publish-via-partition-root">
<term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term> <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>

View File

@ -438,16 +438,18 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
the case of different <literal>WHERE</literal> clauses, if one of the the case of different <literal>WHERE</literal> clauses, if one of the
publications has no <literal>WHERE</literal> clause (referring to that publications has no <literal>WHERE</literal> clause (referring to that
publish operation) or the publication is declared as publish operation) or the publication is declared as
<literal>FOR ALL TABLES</literal> or <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
<literal>FOR TABLES IN SCHEMA</literal>, rows are always published or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
regardless of the definition of the other expressions. rows are always published regardless of the definition of the other
If the subscriber is a <productname>PostgreSQL</productname> version before expressions. If the subscriber is a <productname>PostgreSQL</productname>
15, then any row filtering is ignored during the initial data synchronization version before 15, then any row filtering is ignored during the initial data
phase. For this case, the user might want to consider deleting any initially synchronization phase. For this case, the user might want to consider
copied data that would be incompatible with subsequent filtering. deleting any initially copied data that would be incompatible with
Because initial data synchronization does not take into account the publication subsequent filtering. Because initial data synchronization does not take
<literal>publish</literal> parameter when copying existing table data, some rows into account the publication
may be copied that would not be replicated using DML. See <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
parameter when copying existing table data, some rows may be copied that
would not be replicated using DML. See
<xref linkend="logical-replication-subscription-examples"/> for examples. <xref linkend="logical-replication-subscription-examples"/> for examples.
</para> </para>

View File

@ -2145,9 +2145,10 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
information about the mapping between publications and information of information about the mapping between publications and information of
tables they contain. Unlike the underlying catalog tables they contain. Unlike the underlying catalog
<link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>, <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
this view expands publications defined as <literal>FOR ALL TABLES</literal> this view expands publications defined as
and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
there will be a row for each eligible table. and <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
so for such publications there will be a row for each eligible table.
</para> </para>
<table> <table>