ALTER SUBSCRIPTION
ALTER SUBSCRIPTION
7
SQL - Language Statements
ALTER SUBSCRIPTION
change the definition of a subscription
ALTER SUBSCRIPTION name WITH ( suboption [, ... ] )
where suboption can be:
SLOT NAME = slot_name
| SYNCHRONOUS_COMMIT = synchronous_commit
ALTER SUBSCRIPTION name SET PUBLICATION publication_name [, ...] { REFRESH WITH ( puboption [, ... ] ) | NOREFRESH }
ALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( puboption [, ... ] ) ]
where puboption can be:
COPY DATA | NOCOPY DATA
ALTER SUBSCRIPTION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER SUBSCRIPTION name RENAME TO new_name
ALTER SUBSCRIPTION name CONNECTION 'conninfo'
ALTER SUBSCRIPTION name ENABLE
ALTER SUBSCRIPTION name DISABLE
Description
ALTER SUBSCRIPTION can change most of the subscription
properties that can be specified
in .
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.
Parameters
name
The name of a subscription whose properties are to be altered.
new_owner
The user name of the new owner of the subscription.
new_name
The new name for the subscription.
CONNECTION 'conninfo'
SLOT NAME = slot_name
SYNCHRONOUS_COMMIT = synchronous_commit
These clauses alter properties originally set by
. See there for more
information.
SET PUBLICATION publication_name
Changes list of subscribed publications. See
for more information.
When REFRESH is specified, this command will also
act like REFRESH PUBLICATION. When
NOREFRESH is specified, the comamnd will not try to
refresh table information.
REFRESH PUBLICATION
Fetch missing table information from publisher. This will start
replication of tables that were added to the subscribed-to publications
since the last invocation of REFRESH PUBLICATION or
since CREATE SUBSCRIPTION.
The COPY DATA and NOCOPY DATA
options specify if the existing data in the publications that are being
subscribed to should be copied. COPY DATA is the
default.
ENABLE
Enables the previously disabled subscription, starting the logical
replication worker at the end of transaction.
DISABLE
Disables the running subscription, stopping the logical replication
worker at the end of transaction.
Examples
Change the publication subscribed by a subscription to
insert_only:
ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;
Disable (stop) the subscription:
ALTER SUBSCRIPTION mysub DISABLE;
Compatibility
ALTER SUBSCRIPTION is a PostgreSQL>
extension.
See Also