# ALTER_SUBSCRIPTION(7) - man - phpMan

ALTER [SUBSCRIPTION(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)              PostgreSQL 14.23 Documentation              ALTER [SUBSCRIPTION(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)



## NAME
       ALTER_SUBSCRIPTION - change the definition of a subscription

## SYNOPSIS
       ALTER SUBSCRIPTION _name_ CONNECTION '_conninfo_'
       ALTER SUBSCRIPTION _name_ SET PUBLICATION _publication_name_ [, ...] [ WITH ( _publication_option_ [= _value_] [, ... ] ) ]
       ALTER SUBSCRIPTION _name_ ADD PUBLICATION _publication_name_ [, ...] [ WITH ( _publication_option_ [= _value_] [, ... ] ) ]
       ALTER SUBSCRIPTION _name_ DROP PUBLICATION _publication_name_ [, ...] [ WITH ( _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_ROLE | CURRENT_USER | SESSION_USER }
       ALTER SUBSCRIPTION _name_ RENAME TO _new_name_

## DESCRIPTION
       **ALTER** **SUBSCRIPTION** can change most of the subscription properties that can be specified in
       CREATE SUBSCRIPTION (**CREATE**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)).

       You must own the subscription to use **ALTER** **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.
       (Currently, all subscription owners must be superusers, so the owner checks will be bypassed
       in practice. But this might change in the future.)

       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 DROP SUBSCRIPTION (**DROP**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)).

       Commands **ALTER** **SUBSCRIPTION** **...** **REFRESH** **PUBLICATION** and **ALTER** **SUBSCRIPTION** **...** **{SET|ADD|DROP}**
       **PUBLICATION** **...**  with refresh option as true cannot be executed inside a transaction block.

## PARAMETERS
       _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
           (**CREATE**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)). See there for more information.

       SET PUBLICATION _publication_name_
       ADD PUBLICATION _publication_name_
       DROP PUBLICATION _publication_name_
           Changes the list of subscribed publications.  SET replaces the entire list of
           publications with a new list, ADD adds additional publications to the list of
           publications, and DROP removes the publications from the list of publications. See CREATE
           SUBSCRIPTION (**CREATE**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)) for more information. By default, this command will
           also act like REFRESH PUBLICATION.

           _publication_option_ specifies additional options for this operation. The supported options
           are:

           refresh (boolean)
               When false, the command will not try to refresh table information.  REFRESH
               PUBLICATION should then be executed separately. The default is true.

           Additionally, the options described under REFRESH PUBLICATION may be specified, to
           control the implicit refresh operation.

       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. (Previously
               subscribed tables are not copied.)

       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
           (**CREATE**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)). See there for more information. The parameters that can be
           altered are slot_name, synchronous_commit, binary, and streaming.

       _new_owner_
           The user name of the new owner of the subscription.

       _new_name_
           The new name for the subscription.

## 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
       CREATE SUBSCRIPTION (**CREATE**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)), DROP SUBSCRIPTION (**DROP**___**[SUBSCRIPTION**(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)),
       CREATE PUBLICATION (**CREATE**___**[PUBLICATION**(7)](https://www.chedong.com/phpMan.php/man/PUBLICATION/7/markdown)), ALTER PUBLICATION (**ALTER**___**[PUBLICATION**(7)](https://www.chedong.com/phpMan.php/man/PUBLICATION/7/markdown))



PostgreSQL 14.23                                2026                           ALTER [SUBSCRIPTION(7)](https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/markdown)
