ALTER PUBLICATION — change the definition of a publication
ALTER PUBLICATIONnameADD TABLE [ ONLY ]table_name[ * ] [, ...] ALTER PUBLICATIONnameSET TABLE [ ONLY ]table_name[ * ] [, ...] ALTER PUBLICATIONnameDROP TABLE [ ONLY ]table_name[ * ] [, ...] ALTER PUBLICATIONnameSET (publication_parameter[=value] [, ... ] ) ALTER PUBLICATIONnameOWNER TO {new_owner| CURRENT_USER | SESSION_USER } ALTER PUBLICATIONnameRENAME TOnew_name
The first variant of this command listed in the synopsis can change all of the publication properties specified in CREATE PUBLICATION. Properties not mentioned in the command retain their previous settings.
To alter the owner, you must also be a direct or indirect member of the new
owning role. The new owner must have CREATE privilege on
the database. Also, the new owner of a FOR ALL TABLES
publication must be a superuser. However, a superuser can change the
ownership of a publication while circumventing these restrictions.
The other variants of this command deal with the table membership of the
publication. The SET TABLE clause will replace the
list of tables in the publication with the specified one.
The ADD TABLE and
DROP TABLE will add and remove one or more tables from
the publication.
nameThe name of an existing publication whose definition is to be altered.
table_name Name of an existing table. If ONLY is specified before the
table name, only that table is affected. If ONLY is not
specified, the table and all its descendant tables (if any) are
affected. Optionally, * can be specified after the table
name to explicitly indicate that descendant tables are included.
SET ( publication_parameter [= value] [, ... ] )This clause alters publication parameters originally set by CREATE PUBLICATION. See there for more information.
new_ownerThe user name of the new owner of the publication.
new_nameThe new name for the publication.
Change the publication to publish only deletes and updates:
ALTER PUBLICATION noinsert SET (publish = 'update, delete');
Add some tables to the publication:
ALTER PUBLICATION mypublication ADD TABLE users, departments;
ALTER PUBLICATION is a PostgreSQL
extension.