forked from openGauss-Ecosystem/openGauss-server
fix publication ci problem
This commit is contained in:
parent
e0960a0dbd
commit
40b128e5cd
|
@ -0,0 +1,150 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/alter_publication.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-ALTERPUBLICATION">
|
||||
<indexterm zone="sql-alterpublication">
|
||||
<primary>ALTER PUBLICATION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>ALTER PUBLICATION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>ALTER PUBLICATION</refname>
|
||||
<refpurpose>change the definition of a publication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> ADD TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> DROP TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
|
||||
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
The command <command>ALTER PUBLICATION</command> can change the attributes
|
||||
of a publication.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The first three variants change which tables are part of the publication.
|
||||
The <literal>SET TABLE</literal> clause will replace the list of tables in
|
||||
the publication with the specified one. The <literal>ADD TABLE</literal>
|
||||
and <literal>DROP TABLE</literal> clauses will add and remove one or more
|
||||
tables from the publication.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The fourth variant of this command listed in the synopsis can change
|
||||
all of the publication properties specified in
|
||||
<xref linkend="sql-createpublication"/>. Properties not mentioned in the
|
||||
command retain their previous settings.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The remaining variants change the owner and the name of the publication.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You must own the publication to use <command>ALTER PUBLICATION</command>.
|
||||
Adding a table to a publication additionally requires owning that table.
|
||||
To alter the owner, you must also be a direct or indirect member of the new
|
||||
owning role. The new owner must have <literal>CREATE</literal> privilege on
|
||||
the database. Also, the new owner of a <literal>FOR ALL TABLES</literal>
|
||||
publication must be a superuser. However, a superuser can change the
|
||||
ownership of a publication regardless of these restrictions.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of an existing publication whose definition is to be altered.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>SET ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This clause alters publication parameters originally set by
|
||||
<xref linkend="SQL-CREATEPUBLICATION">. See there for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">new_owner</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The user name of the new owner of the publication.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">new_name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The new name for the publication.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
Change the publication to publish only deletes and updates:
|
||||
<programlisting>
|
||||
ALTER PUBLICATION noinsert SET (publish = 'update, delete');
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Add some tables to the publication:
|
||||
<programlisting>
|
||||
ALTER PUBLICATION mypublication ADD TABLE users, departments;
|
||||
</programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>ALTER PUBLICATION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-createpublication"/></member>
|
||||
<member><xref linkend="sql-droppublication"/></member>
|
||||
<member><xref linkend="sql-createsubscription"/></member>
|
||||
<member><xref linkend="sql-altersubscription"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,141 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/alter_subscription.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-ALTERSUBSCRIPTION">
|
||||
<indexterm zone="sql-altersubscription">
|
||||
<primary>ALTER SUBSCRIPTION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>ALTER SUBSCRIPTION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>ALTER SUBSCRIPTION</refname>
|
||||
<refpurpose>change the definition of a subscription</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> CONNECTION '<replaceable>conninfo</replaceable>'
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ENABLE
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
|
||||
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<command>ALTER SUBSCRIPTION</command> can change most of the subscription
|
||||
properties that can be specified
|
||||
in <xref linkend="sql-createsubscription"/>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You must own the subscription to use <command>ALTER SUBSCRIPTION</command>.
|
||||
To alter the owner, you must also be a direct or indirect member of the
|
||||
new owning role. The new owner has to be a superuser.
|
||||
(Currently, all subscription owners must be superusers, so the owner checks
|
||||
will be bypassed in practice. But this might change in the future.)
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of a subscription whose properties are to be altered.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This clause alters the connection property originally set by
|
||||
<xref linkend="sql-createsubscription"/>. See there for more
|
||||
information.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>SET PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>ENABLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Enables the previously disabled subscription, starting the logical
|
||||
replication worker at the end of transaction.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This clause alters parameters originally set by
|
||||
<xref linkend="sql-createsubscription"/>. See there for more
|
||||
information. The parameters that can be altered
|
||||
are <literal>slot_name</literal> and
|
||||
<literal>synchronous_commit</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">new_owner</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The user name of the new owner of the subscription.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">new_name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The new name for the subscription.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>ALTER SUBSCRIPTION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-createsubscription"/></member>
|
||||
<member><xref linkend="sql-dropsubscription"/></member>
|
||||
<member><xref linkend="sql-createpublication"/></member>
|
||||
<member><xref linkend="sql-alterpublication"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,220 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/create_publication.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-CREATEPUBLICATION">
|
||||
<indexterm zone="sql-createpublication">
|
||||
<primary>CREATE PUBLICATION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>CREATE PUBLICATION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>CREATE PUBLICATION</refname>
|
||||
<refpurpose>define a new publication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
|
||||
[ FOR TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
|
||||
| FOR ALL TABLES ]
|
||||
[ WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<command>CREATE PUBLICATION</command> adds a new publication
|
||||
into the current database. The publication name must be distinct from
|
||||
the name of any existing publication in the current database.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A publication is essentially a group of tables whose data changes are
|
||||
intended to be replicated through logical replication. See
|
||||
<xref linkend="logical-replication-publication"/> for details about how
|
||||
publications fit into the logical replication setup.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the new publication.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>FOR TABLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies a list of tables to add to the publication.
|
||||
|
||||
<para>
|
||||
Only persistent base tables and partitioned tables can be part of a
|
||||
publication. Temporary tables, unlogged tables, foreign tables,
|
||||
materialized views, and regular views cannot be part of a publication.
|
||||
</para>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>FOR ALL TABLES</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Marks the publication as one that replicates changes for all tables in
|
||||
the database, including tables created in the future.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This clause specifies optional parameters for a publication. The
|
||||
following parameters are supported:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>publish</literal> (<type>string</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This parameter determines which DML operations will be published by
|
||||
the new publication to the subscribers. The value is
|
||||
comma-separated list of operations. The allowed operations are
|
||||
<literal>insert</literal>, <literal>update</literal> and
|
||||
<literal>delete</literal>.
|
||||
The default is to publish all actions,
|
||||
and so the default value for this option is
|
||||
<literal>'insert, update, delete'</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>PUBLISH DELETE</literal></term>
|
||||
<term><literal>NOPUBLISH DELETE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
These clauses determine whether the new publication will send
|
||||
the <command>DELETE</command> operations to the subscribers.
|
||||
<literal>PUBLISH DELETE</literal> is the default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>
|
||||
If neither <literal>FOR TABLE</literal> nor <literal>FOR ALL
|
||||
TABLES</literal> is specified, then the publication starts out with an
|
||||
empty set of tables. That is useful if tables are to be added later.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The creation of a publication does not start replication. It only defines
|
||||
a grouping and filtering logic for future subscribers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To create a publication, the invoking user must have the
|
||||
<literal>CREATE</literal> privilege for the current database.
|
||||
(Of course, superusers bypass this check.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To add a table to a publication, the invoking user must have ownership
|
||||
rights on the table. The <command>FOR ALL TABLES</command> clause requires
|
||||
the invoking user to be a superuser.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The tables added to a publication that publishes <command>UPDATE</command>
|
||||
and/or <command>DELETE</command> operations must have
|
||||
<literal>REPLICA IDENTITY</literal> defined. Otherwise those operations will be
|
||||
disallowed on those tables.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For an <command>INSERT ... ON CONFLICT</command> command, the publication will
|
||||
publish the operation that actually results from the command. So depending
|
||||
of the outcome, it may be published as either <command>INSERT</command> or
|
||||
<command>UPDATE</command>, or it may not be published at all.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<command>COPY ... FROM</command> commands are published
|
||||
as <command>INSERT</command> operations.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<acronym>DDL</acronym> operations are not published.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
Create a publication that publishes all changes in two tables:
|
||||
<programlisting>
|
||||
CREATE PUBLICATION mypublication FOR TABLE users, departments;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Create a publication that publishes all changes in all tables:
|
||||
<programlisting>
|
||||
CREATE PUBLICATION alltables FOR ALL TABLES;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Create a publication that only publishes <command>INSERT</command>
|
||||
operations in one table:
|
||||
<programlisting>
|
||||
CREATE PUBLICATION insert_only FOR TABLE mydata
|
||||
WITH (publish = 'insert');
|
||||
</programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>CREATE PUBLICATION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-alterpublication"/></member>
|
||||
<member><xref linkend="sql-droppublication"/></member>
|
||||
<member><xref linkend="sql-createsubscription"/></member>
|
||||
<member><xref linkend="sql-altersubscription"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,236 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/create_subscription.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-CREATESUBSCRIPTION">
|
||||
<indexterm zone="sql-createsubscription">
|
||||
<primary>CREATE SUBSCRIPTION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>CREATE SUBSCRIPTION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>CREATE SUBSCRIPTION</refname>
|
||||
<refpurpose>define a new subscription</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceable>
|
||||
CONNECTION '<replaceable class="parameter">conninfo</replaceable>'
|
||||
PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]
|
||||
[ WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<command>CREATE SUBSCRIPTION</command> adds a new subscription for the
|
||||
current database. The subscription name must be distinct from the name of
|
||||
any existing subscription in the database.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The subscription represents a replication connection to the publisher. As
|
||||
such this command does not only add definitions in the local catalogs but
|
||||
also creates a replication slot on the publisher.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A logical replication worker will be started to replicate data for the new
|
||||
subscription at the commit of the transaction where this command is run.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Additional information about subscriptions and logical replication as a
|
||||
whole is available at <xref linkend="logical-replication-subscription"/> and
|
||||
<xref linkend="logical-replication"/>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">subscription_name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the new subscription.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The connection string to the publisher. For details
|
||||
see <xref linkend="libpq-connstring"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Names of the publications on the publisher to subscribe to.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This clause specifies optional parameters for a subscription. The
|
||||
following parameters are supported:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>enabled</literal> (<type>boolean</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies whether the subscription should be actively replicating,
|
||||
or whether it should be just setup but not started yet. The default
|
||||
is <literal>true</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>slot_name</literal> (<type>string</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of the replication slot to use. The default behavior is to
|
||||
use the name of the subscription for the slot name.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When <literal>slot_name</literal> is set to
|
||||
<literal>NONE</literal>, there will be no replication slot
|
||||
associated with the subscription. This can be used if the
|
||||
replication slot will be created later manually. Such
|
||||
subscriptions must also have both <literal>enabled</literal> and
|
||||
<literal>create_slot</literal> set to <literal>false</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The value of this parameter overrides the
|
||||
<xref linkend="guc-synchronous-commit"/> setting within this
|
||||
subscription's apply worker processes. The default value
|
||||
is <literal>off</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is safe to use <literal>off</literal> for logical replication:
|
||||
If the subscriber loses transactions because of missing
|
||||
synchronization, the data will be sent again from the publisher.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A different setting might be appropriate when doing synchronous
|
||||
logical replication. The logical replication workers report the
|
||||
positions of writes and flushes to the publisher, and when using
|
||||
synchronous replication, the publisher will wait for the actual
|
||||
flush. This means that setting
|
||||
<literal>synchronous_commit</literal> for the subscriber to
|
||||
<literal>off</literal> when the subscription is used for
|
||||
synchronous replication might increase the latency for
|
||||
<command>COMMIT</command> on the publisher. In this scenario, it
|
||||
can be advantageous to set <literal>synchronous_commit</literal>
|
||||
to <literal>local</literal> or higher.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>
|
||||
See <xref linkend="logical-replication-security"/> for details on
|
||||
how to configure access control between the subscription and the
|
||||
publication instance.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When creating a replication slot (the default behavior), <command>CREATE
|
||||
SUBSCRIPTION</command> cannot be executed inside a transaction block.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Creating a subscription that connects to the same database cluster (for
|
||||
example, to replicate between databases in the same cluster or to replicate
|
||||
within the same database) will only succeed if the replication slot is not
|
||||
created as part of the same command. Otherwise, the <command>CREATE
|
||||
SUBSCRIPTION</command> call will hang. This is an
|
||||
implementation restriction that might be lifted in a future release.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
Create a subscription to a remote server that replicates tables in
|
||||
the publications <literal>mypublication</literal> and
|
||||
<literal>insert_only</literal> and starts replicating immediately on
|
||||
commit:
|
||||
<programlisting>
|
||||
CREATE SUBSCRIPTION mysub
|
||||
CONNECTION 'host=192.168.1.50 port=5432 user=foo dbname=foodb'
|
||||
PUBLICATION mypublication, insert_only;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Create a subscription to a remote server that replicates tables in
|
||||
the <literal>insert_only</literal> publication and does not start replicating
|
||||
until enabled at a later time.
|
||||
<programlisting>
|
||||
CREATE SUBSCRIPTION mysub
|
||||
CONNECTION 'host=192.168.1.50 port=5432 user=foo dbname=foodb'
|
||||
PUBLICATION insert_only
|
||||
WITH (enabled = false);
|
||||
</programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>CREATE SUBSCRIPTION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-altersubscription"/></member>
|
||||
<member><xref linkend="sql-dropsubscription"/></member>
|
||||
<member><xref linkend="sql-createpublication"/></member>
|
||||
<member><xref linkend="sql-alterpublication"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,105 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/drop_publication.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-DROPPUBLICATION">
|
||||
<indexterm zone="sql-droppublication">
|
||||
<primary>DROP PUBLICATION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>DROP PUBLICATION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>DROP PUBLICATION</refname>
|
||||
<refpurpose>remove a publication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
DROP PUBLICATION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<command>DROP PUBLICATION</command> removes an existing publication from
|
||||
the database.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A publication can only be dropped by its owner or a superuser.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>IF EXISTS</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Do not throw an error if the publication does not exist. A notice is
|
||||
issued in this case.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of an existing publication.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CASCADE</literal></term>
|
||||
<term><literal>RESTRICT</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
These key words do not have any effect, since there are no dependencies
|
||||
on publications.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
Drop a publication:
|
||||
<programlisting>
|
||||
DROP PUBLICATION mypublication;
|
||||
</programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>DROP PUBLICATION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-createpublication"/></member>
|
||||
<member><xref linkend="sql-alterpublication"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,101 @@
|
|||
<!--
|
||||
doc/src/sgml/ref/drop_subscription.sgml
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-DROPSUBSCRIPTION">
|
||||
<indexterm zone="sql-dropsubscription">
|
||||
<primary>DROP SUBSCRIPTION</primary>
|
||||
</indexterm>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>DROP SUBSCRIPTION</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>DROP SUBSCRIPTION</refname>
|
||||
<refpurpose>remove a subscription</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ CASCADE | RESTRICT ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<command>DROP SUBSCRIPTION</command> removes a subscription from the
|
||||
database cluster.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A subscription can only be dropped by a superuser.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The replication worker associated with the subscription will not stop until
|
||||
after the transaction that issued this command has committed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Parameters</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of a subscription to be dropped.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CASCADE</literal></term>
|
||||
<term><literal>RESTRICT</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
These key words do not have any effect, since there are no dependencies
|
||||
on subscriptions.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
Drop a subscription:
|
||||
<programlisting>
|
||||
DROP SUBSCRIPTION mysub;
|
||||
</programlisting></para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
<command>DROP SUBSCRIPTION</command> is a <productname>PostgreSQL</productname>
|
||||
extension.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simplelist type="inline">
|
||||
<member><xref linkend="sql-createsubscription"/></member>
|
||||
<member><xref linkend="sql-altersubscription"/></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -1,9 +1,9 @@
|
|||
--clear audit log
|
||||
SELECT pg_delete_audit('1012-11-10', '3012-11-11');
|
||||
--- prepare
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/usermapping.key.cipher
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/usermapping.key.rand
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o usermapping > /dev/null 2>&1 ; echo $?
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/usermapping.key.cipher
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/usermapping.key.rand
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o usermapping > /dev/null 2>&1 ; echo $?
|
||||
CREATE ROLE regress_usermapping_user LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
SET SESSION AUTHORIZATION 'regress_usermapping_user' PASSWORD 'Abcdef@123';
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ SELECT pg_delete_audit('1012-11-10', '3012-11-11');
|
|||
--enable publication and subscription audit
|
||||
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "audit_system_object=16777215" > /dev/null 2>&1
|
||||
--- prepare
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/subscription.key.cipher
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/subscription.key.rand
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o subscription > /dev/null 2>&1 ; echo $?
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/subscription.key.cipher
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/subscription.key.rand
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o subscription > /dev/null 2>&1 ; echo $?
|
||||
CREATE ROLE regress_subscription_user LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
CREATE ROLE regress_subscription_user2 LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
SET SESSION AUTHORIZATION 'regress_subscription_user' PASSWORD 'Abcdef@123';
|
||||
|
|
|
@ -6,9 +6,9 @@ SELECT pg_delete_audit('1012-11-10', '3012-11-11');
|
|||
(1 row)
|
||||
|
||||
--- prepare
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/usermapping.key.cipher
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/usermapping.key.rand
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o usermapping > /dev/null 2>&1 ; echo $?
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/usermapping.key.cipher
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/usermapping.key.rand
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o usermapping > /dev/null 2>&1 ; echo $?
|
||||
0
|
||||
CREATE ROLE regress_usermapping_user LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
SET SESSION AUTHORIZATION 'regress_usermapping_user' PASSWORD 'Abcdef@123';
|
||||
|
|
|
@ -38,9 +38,9 @@ SELECT pg_delete_audit('1012-11-10', '3012-11-11');
|
|||
--enable publication and subscription audit
|
||||
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "audit_system_object=16777215" > /dev/null 2>&1
|
||||
--- prepare
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/subscription.key.cipher
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} rm -f {}/bin/subscription.key.rand
|
||||
\! echo $GAUSSHOME | sed 's/^.*tmp_check\/install\///g' | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o subscription > /dev/null 2>&1 ; echo $?
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/subscription.key.cipher
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} rm -f {}/bin/subscription.key.rand
|
||||
\! echo $OLDGAUSSHOME | xargs -I{} @abs_bindir@/gs_guc generate -S 123456@pwd -D {}/bin -o subscription > /dev/null 2>&1 ; echo $?
|
||||
0
|
||||
CREATE ROLE regress_subscription_user LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
CREATE ROLE regress_subscription_user2 LOGIN SYSADMIN PASSWORD 'Abcdef@123';
|
||||
|
|
|
@ -899,11 +899,11 @@ test: toomanyparams
|
|||
|
||||
test: test_astore_multixact
|
||||
test: component_view_enhancements
|
||||
#test: single_node_user_mapping
|
||||
test: single_node_user_mapping
|
||||
|
||||
# publication and subscription, we need to record audit log for them, so seperate them into two test group
|
||||
#test: publication
|
||||
#test: subscription
|
||||
test: publication
|
||||
test: subscription
|
||||
test: fdw_audit
|
||||
test: gs_global_config_audit
|
||||
test: detail
|
||||
|
|
Loading…
Reference in New Issue