ALTER SUBSCRIPTION — change the definition of a subscription
ALTER SUBSCRIPTIONname
CONNECTION 'conninfo
' ALTER SUBSCRIPTIONname
SET PUBLICATIONpublication_name
[, ...] { REFRESH [ WITH (refresh_option
value
[, ... ] ) ] | SKIP REFRESH } ALTER SUBSCRIPTIONname
REFRESH PUBLICATION [ WITH (refresh_option
value
[, ... ] ) ] ALTER SUBSCRIPTIONname
ENABLE ALTER SUBSCRIPTIONname
DISABLE ALTER SUBSCRIPTIONname
SET (subscription_parameter
[=value
] [, ... ] ) ALTER SUBSCRIPTIONname
OWNER TO {new_owner
| CURRENT_USER | SESSION_USER } ALTER SUBSCRIPTIONname
RENAME TOnew_name
ALTER SUBSCRIPTION
can change most of the subscription
properties that can be specified
in CREATE SUBSCRIPTION.
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.
name
The name of a subscription whose properties are to be altered.
CONNECTION 'conninfo
'
This clause alters the connection property originally set by CREATE SUBSCRIPTION. See there for more information.
SET PUBLICATION publication_name
Changes list of subscribed publications. See CREATE SUBSCRIPTION for more information.
When REFRESH
is specified, this command will also act
like REFRESH
PUBLICATION
. refresh_option
specifies
additional options for the refresh operation, as described
under REFRESH PUBLICATION
. When
SKIP REFRESH
is specified, the command will not try
to refresh table information. Note that
either REFRESH
or SKIP REFRESH
must be specified.
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
.
refresh_option
specifies additional options for the
refresh operation. The supported options are:
copy_data
(boolean
) Specifies whether the existing data in the publications that are
being subscribed to should be copied once the replication starts.
The default is true
.
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.
SET ( subscription_parameter
[= value
] [, ... ] )
This clause alters parameters originally set by
CREATE SUBSCRIPTION. See there for more
information. The allowed options are slot_name
and
synchronous_commit
new_owner
The user name of the new owner of the subscription.
new_name
The new name for the subscription.
Change the publication subscribed by a subscription to
insert_only
:
ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only REFRESH;
Disable (stop) the subscription:
ALTER SUBSCRIPTION mysub DISABLE;
ALTER SUBSCRIPTION
is a PostgreSQL
extension.