{
    "mode": "man",
    "parameter": "ALTER_PUBLICATION",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ALTER_PUBLICATION/7/json",
    "generated": "2026-10-07T15:37:06Z",
    "synopsis": "ALTER PUBLICATION name ADD publicationobject [, ...]\nALTER PUBLICATION name SET publicationobject [, ...]\nALTER PUBLICATION name DROP publicationdropobject [, ...]\nALTER PUBLICATION name SET ( publicationparameter [= value] [, ... ] )\nALTER PUBLICATION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER PUBLICATION name RENAME TO newname\nwhere publicationobject is one of:\nTABLE tableandcolumns [, ... ]\nTABLES IN SCHEMA { schemaname | CURRENTSCHEMA } [, ... ]\nand publicationdropobject is one of:\nTABLE [ ONLY ] tablename [ * ] [, ... ]\nTABLES IN SCHEMA { schemaname | CURRENTSCHEMA } [, ... ]\nand tableandcolumns is:\n[ ONLY ] tablename [ * ] [ ( columnname [, ... ] ) ] [ WHERE ( expression ) ]",
    "sections": {
        "NAME": {
            "content": "ALTERPUBLICATION - change the definition of a publication\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ALTER PUBLICATION name ADD publicationobject [, ...]\nALTER PUBLICATION name SET publicationobject [, ...]\nALTER PUBLICATION name DROP publicationdropobject [, ...]\nALTER PUBLICATION name SET ( publicationparameter [= value] [, ... ] )\nALTER PUBLICATION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER PUBLICATION name RENAME TO newname\n\nwhere publicationobject is one of:\n\nTABLE tableandcolumns [, ... ]\nTABLES IN SCHEMA { schemaname | CURRENTSCHEMA } [, ... ]\n\nand publicationdropobject is one of:\n\nTABLE [ ONLY ] tablename [ * ] [, ... ]\nTABLES IN SCHEMA { schemaname | CURRENTSCHEMA } [, ... ]\n\nand tableandcolumns is:\n\n[ ONLY ] tablename [ * ] [ ( columnname [, ... ] ) ] [ WHERE ( expression ) ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The command ALTER PUBLICATION can change the attributes of a publication.\n\nThe first three variants change which tables/schemas are part of the publication. The SET\nclause will replace the list of tables/schemas in the publication with the specified list;\nthe existing tables/schemas that were present in the publication will be removed. The ADD and\nDROP clauses will add and remove one or more tables/schemas from the publication. Note that\nadding tables/schemas to a publication that is already subscribed to will require an ALTER\nSUBSCRIPTION ... REFRESH PUBLICATION action on the subscribing side in order to become\neffective. Note also that DROP TABLES IN SCHEMA will not drop any schema tables that were\nspecified using FOR TABLE/ ADD TABLE.\n\nThe fourth variant of this command listed in the synopsis can change all of the publication\nproperties specified in CREATE PUBLICATION (CREATEPUBLICATION(7)). Properties not mentioned\nin the command retain their previous settings.\n\nThe remaining variants change the owner and the name of the publication.\n\nYou must own the publication to use ALTER PUBLICATION. Adding a table to a publication\nadditionally requires owning that table. The ADD TABLES IN SCHEMA and SET TABLES IN SCHEMA to\na publication requires the invoking user to be a superuser. To alter the owner, you must be\nable to SET ROLE to the new owning role, and that role must have CREATE privilege on the\ndatabase. Also, the new owner of a FOR ALL TABLES or FOR TABLES IN SCHEMA publication must be\na superuser. However, a superuser can change the ownership of a publication regardless of\nthese restrictions.\n\nAdding/Setting any schema when the publication also publishes a table with a column list, and\nvice versa is not supported.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name of an existing publication whose definition is to be altered.\n\ntablename\nName of an existing table. If ONLY is specified before the table name, only that table is\naffected. If ONLY is not specified, the table and all its descendant tables (if any) are\naffected. Optionally, * can be specified after the table name to explicitly indicate that\ndescendant tables are included.\n\nOptionally, a column list can be specified. See CREATE PUBLICATION\n(CREATEPUBLICATION(7)) for details. Note that a subscription having several publications\nin which the same table has been published with different column lists is not supported.\nSee Warning: Combining Column Lists from Multiple Publications for details of potential\nproblems when altering column lists.\n\nIf the optional WHERE clause is specified, rows for which the expression evaluates to\nfalse or null will not be published. Note that parentheses are required around the\nexpression. The expression is evaluated with the role used for the replication\nconnection.\n\nschemaname\nName of an existing schema.\n\nSET ( publicationparameter [= value] [, ... ] )\nThis clause alters publication parameters originally set by CREATE PUBLICATION\n(CREATEPUBLICATION(7)). See there for more information.\n\nnewowner\nThe user name of the new owner of the publication.\n\nnewname\nThe new name for the publication.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Change the publication to publish only deletes and updates:\n\nALTER PUBLICATION noinsert SET (publish = 'update, delete');\n\nAdd some tables to the publication:\n\nALTER PUBLICATION mypublication ADD TABLE users (userid, firstname), departments;\n\nChange the set of columns published for a table:\n\nALTER PUBLICATION mypublication SET TABLE users (userid, firstname, lastname), TABLE departments;\n\nAdd schemas marketing and sales to the publication salespublication:\n\nALTER PUBLICATION salespublication ADD TABLES IN SCHEMA marketing, sales;\n\nAdd tables users, departments and schema production to the publication\nproductionpublication:\n\nALTER PUBLICATION productionpublication ADD TABLE users, departments, TABLES IN SCHEMA production;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "ALTER PUBLICATION is a PostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CREATE PUBLICATION (CREATEPUBLICATION(7)), DROP PUBLICATION (DROPPUBLICATION(7)), CREATE\nSUBSCRIPTION (CREATESUBSCRIPTION(7)), ALTER SUBSCRIPTION (ALTERSUBSCRIPTION(7))\n\nPostgreSQL 16.14                                2026                            ALTER PUBLICATION(7)",
            "subsections": []
        }
    },
    "summary": "ALTERPUBLICATION - change the definition of a publication",
    "flags": [],
    "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 (userid, firstname), departments;",
        "Change the set of columns published for a table:",
        "ALTER PUBLICATION mypublication SET TABLE users (userid, firstname, lastname), TABLE departments;",
        "Add schemas marketing and sales to the publication salespublication:",
        "ALTER PUBLICATION salespublication ADD TABLES IN SCHEMA marketing, sales;",
        "Add tables users, departments and schema production to the publication",
        "productionpublication:",
        "ALTER PUBLICATION productionpublication ADD TABLE users, departments, TABLES IN SCHEMA production;"
    ],
    "see_also": [
        {
            "name": "CREATEPUBLICATION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATEPUBLICATION/7/json"
        },
        {
            "name": "DROPPUBLICATION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DROPPUBLICATION/7/json"
        },
        {
            "name": "CREATESUBSCRIPTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATESUBSCRIPTION/7/json"
        },
        {
            "name": "ALTERSUBSCRIPTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/ALTERSUBSCRIPTION/7/json"
        },
        {
            "name": "PUBLICATION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/PUBLICATION/7/json"
        }
    ]
}