ALTER_PUBLICATION(7pg13)
Okay bestie, welcome to the ALTER PUBLICATION(7) page from the PostgreSQL 13.23 docs β this is the one that changes a publicationβs definition, and itβs giving very much βedit the group chat membershipβ energy π
β¨
β¨ NAME β¨
ALTER_PUBLICATION β change the definition of a publication. Thatβs the whole vibe: youβve got a publication, and you need to alter it. Iconic, lowkey essential. π«Ά
π οΈ SYNOPSIS π οΈ
ALTER PUBLICATION name ADD TABLE [ ONLY ] table_name [ * ] [, ...]
ALTER PUBLICATION name SET TABLE [ ONLY ] table_name [ * ] [, ...]
ALTER PUBLICATION name DROP TABLE [ ONLY ] table_name [ * ] [, ...]
ALTER PUBLICATION name SET ( publication_parameter [= value] [, ... ] )
ALTER PUBLICATION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER PUBLICATION name RENAME TO new_name
π DESCRIPTION π
The command ALTER PUBLICATION can change the attributes of a publication. Yes bestie, itβs literally in the name β it alters the publication. πΈ
The first three variants change which tables are part 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 clauses will add and remove one or more tables from the publication. Note that adding tables to a publication that is already subscribed to will require a ALTER SUBSCRIPTION ... REFRESH PUBLICATION action on the subscribing side in order to become effective. So yeah, the other side gotta refresh too β no cap. π
The fourth variant of this command listed in the synopsis can change all of the publication properties specified in CREATE PUBLICATION (CREATE_PUBLICATION(7)). Properties not mentioned in the command retain their previous settings. So itβs very βif you donβt say anything, weβre not touching itβ energy. π
The remaining variants change the owner and the name of the publication.
You must own the publication to useALTER PUBLICATION. Adding a table to a publication additionally requires owning that table. To alter the owner, you must also be a direct or indirect member of the new owning role. The new owner must haveCREATEprivilege on the database. Also, the new owner of aFOR ALL TABLESpublication must be a superuser. However, a superuser can change the ownership of a publication regardless of these restrictions. π
π PARAMETERS π
nameβ the name of an existing publication whose definition is to be altered. Like, the publication youβre about to glow-up. πtable_nameβ name of an existing table. IfONLYis specified before the table name, only that table is affected. IfONLYis 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. SoONLYis the βjust this one, pleaseβ flag, and*is the βand the whole family tooβ flag. πSET ( publication_parameter [= value] [, ... ] )β this clause alters publication parameters originally set byCREATE PUBLICATION(CREATE_PUBLICATION(7)). See there for more information. The details live over there, bestie β go peek. πnew_ownerβ the user name of the new owner of the publication. New owner, new main character energy. πnew_nameβ the new name for the publication. Rename slay. β¨
π EXAMPLES π
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;
π¦ COMPATIBILITY π¦
ALTER PUBLICATION is a PostgreSQL extension. Thatβs the compatibility note, periodt. π
π SEE ALSO π
CREATE PUBLICATION(CREATE_PUBLICATION(7))DROP PUBLICATION(DROP_PUBLICATION(7))CREATE SUBSCRIPTION(CREATE_SUBSCRIPTION(7))ALTER SUBSCRIPTION(ALTER_SUBSCRIPTION(7))
And thatβs the page, bestie π«Ά β signed off by PostgreSQL 13.23, dated 2025, with the manual name ALTER PUBLICATION(7) right there in the footer. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms