1ALTER PUBLICATION(7) PostgreSQL 12.6 Documentation ALTER PUBLICATION(7)
2
3
4
6 ALTER_PUBLICATION - change the definition of a publication
7
9 ALTER PUBLICATION name ADD TABLE [ ONLY ] table_name [ * ] [, ...]
10 ALTER PUBLICATION name SET TABLE [ ONLY ] table_name [ * ] [, ...]
11 ALTER PUBLICATION name DROP TABLE [ ONLY ] table_name [ * ] [, ...]
12 ALTER PUBLICATION name SET ( publication_parameter [= value] [, ... ] )
13 ALTER PUBLICATION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
14 ALTER PUBLICATION name RENAME TO new_name
15
17 The command ALTER PUBLICATION can change the attributes of a
18 publication.
19
20 The first three variants change which tables are part of the
21 publication. The SET TABLE clause will replace the list of tables in
22 the publication with the specified one. The ADD TABLE and DROP TABLE
23 clauses will add and remove one or more tables from the publication.
24 Note that adding tables to a publication that is already subscribed to
25 will require a ALTER SUBSCRIPTION ... REFRESH PUBLICATION action on the
26 subscribing side in order to become effective.
27
28 The fourth variant of this command listed in the synopsis can change
29 all of the publication properties specified in CREATE PUBLICATION
30 (CREATE_PUBLICATION(7)). Properties not mentioned in the command retain
31 their previous settings.
32
33 The remaining variants change the owner and the name of the
34 publication.
35
36 You must own the publication to use ALTER PUBLICATION. Adding a table
37 to a publication additionally requires owning that table. To alter the
38 owner, you must also be a direct or indirect member of the new owning
39 role. The new owner must have CREATE privilege on the database. Also,
40 the new owner of a FOR ALL TABLES publication must be a superuser.
41 However, a superuser can change the ownership of a publication
42 regardless of these restrictions.
43
45 name
46 The name of an existing publication whose definition is to be
47 altered.
48
49 table_name
50 Name of an existing table. If ONLY is specified before the table
51 name, only that table is affected. If ONLY is not specified, the
52 table and all its descendant tables (if any) are affected.
53 Optionally, * can be specified after the table name to explicitly
54 indicate that descendant tables are included.
55
56 SET ( publication_parameter [= value] [, ... ] )
57 This clause alters publication parameters originally set by CREATE
58 PUBLICATION (CREATE_PUBLICATION(7)). See there for more
59 information.
60
61 new_owner
62 The user name of the new owner of the publication.
63
64 new_name
65 The new name for the publication.
66
68 Change the publication to publish only deletes and updates:
69
70 ALTER PUBLICATION noinsert SET (publish = 'update, delete');
71
72 Add some tables to the publication:
73
74 ALTER PUBLICATION mypublication ADD TABLE users, departments;
75
77 ALTER PUBLICATION is a PostgreSQL extension.
78
80 CREATE PUBLICATION (CREATE_PUBLICATION(7)), DROP PUBLICATION
81 (DROP_PUBLICATION(7)), CREATE SUBSCRIPTION (CREATE_SUBSCRIPTION(7)),
82 ALTER SUBSCRIPTION (ALTER_SUBSCRIPTION(7))
83
84
85
86PostgreSQL 12.6 2021 ALTER PUBLICATION(7)