1ALTER SUBSCRIPTION(7)    PostgreSQL 14.3 Documentation   ALTER SUBSCRIPTION(7)
2
3
4

NAME

6       ALTER_SUBSCRIPTION - change the definition of a subscription
7

SYNOPSIS

9       ALTER SUBSCRIPTION name CONNECTION 'conninfo'
10       ALTER SUBSCRIPTION name SET PUBLICATION publication_name [, ...] [ WITH ( publication_option [= value] [, ... ] ) ]
11       ALTER SUBSCRIPTION name ADD PUBLICATION publication_name [, ...] [ WITH ( publication_option [= value] [, ... ] ) ]
12       ALTER SUBSCRIPTION name DROP PUBLICATION publication_name [, ...] [ WITH ( publication_option [= value] [, ... ] ) ]
13       ALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refresh_option [= value] [, ... ] ) ]
14       ALTER SUBSCRIPTION name ENABLE
15       ALTER SUBSCRIPTION name DISABLE
16       ALTER SUBSCRIPTION name SET ( subscription_parameter [= value] [, ... ] )
17       ALTER SUBSCRIPTION name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
18       ALTER SUBSCRIPTION name RENAME TO new_name
19

DESCRIPTION

21       ALTER SUBSCRIPTION can change most of the subscription properties that
22       can be specified in CREATE SUBSCRIPTION (CREATE_SUBSCRIPTION(7)).
23
24       You must own the subscription to use ALTER SUBSCRIPTION. To alter the
25       owner, you must also be a direct or indirect member of the new owning
26       role. The new owner has to be a superuser. (Currently, all subscription
27       owners must be superusers, so the owner checks will be bypassed in
28       practice. But this might change in the future.)
29
30       When refreshing a publication we remove the relations that are no
31       longer part of the publication and we also remove the table
32       synchronization slots if there are any. It is necessary to remove these
33       slots so that the resources allocated for the subscription on the
34       remote host are released. If due to network breakdown or some other
35       error, PostgreSQL is unable to remove the slots, an ERROR will be
36       reported. To proceed in this situation, the user either needs to retry
37       the operation or disassociate the slot from the subscription and drop
38       the subscription as explained in DROP SUBSCRIPTION
39       (DROP_SUBSCRIPTION(7)).
40
41       Commands ALTER SUBSCRIPTION ... REFRESH PUBLICATION and ALTER
42       SUBSCRIPTION ... {SET|ADD|DROP} PUBLICATION ...  with refresh option as
43       true cannot be executed inside a transaction block.
44

PARAMETERS

46       name
47           The name of a subscription whose properties are to be altered.
48
49       CONNECTION 'conninfo'
50           This clause alters the connection property originally set by CREATE
51           SUBSCRIPTION (CREATE_SUBSCRIPTION(7)). See there for more
52           information.
53
54       SET PUBLICATION publication_name
55       ADD PUBLICATION publication_name
56       DROP PUBLICATION publication_name
57           Changes the list of subscribed publications.  SET replaces the
58           entire list of publications with a new list, ADD adds additional
59           publications to the list of publications, and DROP removes the
60           publications from the list of publications. See CREATE SUBSCRIPTION
61           (CREATE_SUBSCRIPTION(7)) for more information. By default, this
62           command will also act like REFRESH PUBLICATION.
63
64           publication_option specifies additional options for this operation.
65           The supported options are:
66
67           refresh (boolean)
68               When false, the command will not try to refresh table
69               information.  REFRESH PUBLICATION should then be executed
70               separately. The default is true.
71
72           Additionally, the options described under REFRESH PUBLICATION may
73           be specified, to control the implicit refresh operation.
74
75       REFRESH PUBLICATION
76           Fetch missing table information from publisher. This will start
77           replication of tables that were added to the subscribed-to
78           publications since the last invocation of REFRESH PUBLICATION or
79           since CREATE SUBSCRIPTION.
80
81           refresh_option specifies additional options for the refresh
82           operation. The supported options are:
83
84           copy_data (boolean)
85               Specifies whether the existing data in the publications that
86               are being subscribed to should be copied once the replication
87               starts. The default is true. (Previously subscribed tables are
88               not copied.)
89
90       ENABLE
91           Enables the previously disabled subscription, starting the logical
92           replication worker at the end of transaction.
93
94       DISABLE
95           Disables the running subscription, stopping the logical replication
96           worker at the end of transaction.
97
98       SET ( subscription_parameter [= value] [, ... ] )
99           This clause alters parameters originally set by CREATE SUBSCRIPTION
100           (CREATE_SUBSCRIPTION(7)). See there for more information. The
101           parameters that can be altered are slot_name, synchronous_commit,
102           binary, and streaming.
103
104       new_owner
105           The user name of the new owner of the subscription.
106
107       new_name
108           The new name for the subscription.
109

EXAMPLES

111       Change the publication subscribed by a subscription to insert_only:
112
113           ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;
114
115       Disable (stop) the subscription:
116
117           ALTER SUBSCRIPTION mysub DISABLE;
118

COMPATIBILITY

120       ALTER SUBSCRIPTION is a PostgreSQL extension.
121

SEE ALSO

123       CREATE SUBSCRIPTION (CREATE_SUBSCRIPTION(7)), DROP SUBSCRIPTION
124       (DROP_SUBSCRIPTION(7)), CREATE PUBLICATION (CREATE_PUBLICATION(7)),
125       ALTER PUBLICATION (ALTER_PUBLICATION(7))
126
127
128
129PostgreSQL 14.3                      2022                ALTER SUBSCRIPTION(7)
Impressum