All Products
Search
Document Center

PolarDB:ALTER SUBSCRIPTION

Last Updated:Mar 28, 2026

ALTER SUBSCRIPTION modifies the properties of an existing subscription. Most properties set by CREATE SUBSCRIPTION can be changed with this command.

Prerequisites

Before using ALTER SUBSCRIPTION, make sure that:

  • You own the subscription.

  • To change the owner: you are a direct or indirect member of the new owning role, and the new owner is a superuser.

Currently, all subscription owners must be superusers, so owner checks are bypassed in practice. This may change in a future release.

Synopsis

ALTER SUBSCRIPTION name CONNECTION 'conninfo'
ALTER SUBSCRIPTION name SET PUBLICATION publication_name [, ...] [ WITH ( set_publication_option [= value] [, ... ] ) ]
ALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refresh_option [= value] [, ... ] ) ]
ALTER SUBSCRIPTION name ENABLE
ALTER SUBSCRIPTION name DISABLE
ALTER SUBSCRIPTION name SET ( subscription_parameter [= value] [, ... ] )
ALTER SUBSCRIPTION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER SUBSCRIPTION name RENAME TO new_name

Parameters

name

The name of the subscription to modify.

CONNECTION 'conninfo'

Replaces the connection string originally set by CREATE SUBSCRIPTION. See CREATE SUBSCRIPTION for connection string format details.

SET PUBLICATION publication_name

Changes the list of subscribed publications. By default, this also triggers an implicit REFRESH PUBLICATION.

The following option controls the refresh behavior:

OptionTypeDefaultDescription
refreshbooleantrueWhen false, skips the implicit table refresh. Run REFRESH PUBLICATION separately afterward.

You can also pass any option accepted by REFRESH PUBLICATION to control the implicit refresh operation.

REFRESH PUBLICATION

Fetches updated table information from the publisher. This starts replication for any tables added to the subscribed publications since the last REFRESH PUBLICATION or CREATE SUBSCRIPTION.

OptionTypeDefaultDescription
copy_databooleantrueCopies existing data from newly subscribed publications when replication starts. Previously subscribed tables are not copied.

ENABLE

Activates a previously disabled subscription and starts the logical replication worker at the end of the transaction.

DISABLE

Deactivates the subscription and stops the logical replication worker at the end of the transaction.

SET ( subscription_parameter [= value] [, ...] )

Modifies subscription parameters originally set by CREATE SUBSCRIPTION. PolarDB supports changing the following parameters: slot_name and synchronous_commit.

OWNER TO { new_owner | CURRENT_USER | SESSION_USER }

Changes the owner of the subscription. The new owner must be a superuser.

RENAME TO new_name

Renames the subscription.

Examples

Switch the subscription to a different publication:

ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;

Stop the subscription:

ALTER SUBSCRIPTION mysub DISABLE;

Refresh table information after adding tables to the publication, without copying existing data:

ALTER SUBSCRIPTION mysub REFRESH PUBLICATION WITH (copy_data = false);

Update the connection string to point to a different host:

ALTER SUBSCRIPTION mysub CONNECTION 'host=<new-host> dbname=<dbname> user=<username>';

What's next