RefLib

Reference library for AI

Back

postgresql_16:7.1.31.1 Description

PostgreSQL 16 > Reference > SQL Commands > ALTER SUBSCRIPTION > Description

ALTER SUBSCRIPTION can change most of the subscription properties that can be specified in (see postgresql_16:7.1.82).

You must own the subscription to use ALTER SUBSCRIPTION. To rename a subscription or alter the owner, you must have CREATE permission on the database. In addition, to alter the owner, you must be able to SET ROLE to the new owning role. If the subscription has password_required=false, only superusers can modify it.

When refreshing a publication we remove the relations that are no longer part of the publication and we also remove the table synchronization slots if there are any. It is necessary to remove these slots so that the resources allocated for the subscription on the remote host are released. If due to network breakdown or some other error, PostgreSQL is unable to remove the slots, an error will be reported. To proceed in this situation, the user either needs to retry the operation or disassociate the slot from the subscription and drop the subscription as explained in (see postgresql_16:7.1.131).

Commands ALTER SUBSCRIPTION ... REFRESH PUBLICATION and ALTER SUBSCRIPTION ... {SET|ADD|DROP} PUBLICATION ... with refresh option as true cannot be executed inside a transaction block. These commands also cannot be executed when the subscription has two_phase (see sql-createsubscription-with-two-phase) commit enabled, unless copy_data (see sql-createsubscription-with-copy-data) is false. See column subtwophasestate of pg_subscription (see postgresql_16:8.2.54) to know the actual two-phase state.

Back