{
    "content": [
        {
            "type": "text",
            "text": "# ALTER_SUBSCRIPTION(7) (man)\n\n**Summary:** ALTERSUBSCRIPTION - change the definition of a subscription\n\n**Synopsis:** ALTER SUBSCRIPTION name CONNECTION 'conninfo'\nALTER SUBSCRIPTION name SET PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ADD PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name DROP PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refreshoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ENABLE\nALTER SUBSCRIPTION name DISABLE\nALTER SUBSCRIPTION name SET ( subscriptionparameter [= value] [, ... ] )\nALTER SUBSCRIPTION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER SUBSCRIPTION name RENAME TO newname\n\n## Examples\n\n- `Change the publication subscribed by a subscription to insertonly:`\n- `ALTER SUBSCRIPTION mysub SET PUBLICATION insertonly;`\n- `Disable (stop) the subscription:`\n- `ALTER SUBSCRIPTION mysub DISABLE;`\n\n## See Also\n\n- CREATESUBSCRIPTION(7)\n- DROPSUBSCRIPTION(7)\n- CREATEPUBLICATION(7)\n- ALTERPUBLICATION(7)\n- SUBSCRIPTION(7)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (11 lines)\n- **DESCRIPTION** (19 lines)\n- **PARAMETERS** (58 lines)\n- **EXAMPLES** (8 lines)\n- **COMPATIBILITY** (2 lines)\n- **SEE ALSO** (6 lines)\n\n## Full Content\n\n### NAME\n\nALTERSUBSCRIPTION - change the definition of a subscription\n\n### SYNOPSIS\n\nALTER SUBSCRIPTION name CONNECTION 'conninfo'\nALTER SUBSCRIPTION name SET PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ADD PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name DROP PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refreshoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ENABLE\nALTER SUBSCRIPTION name DISABLE\nALTER SUBSCRIPTION name SET ( subscriptionparameter [= value] [, ... ] )\nALTER SUBSCRIPTION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER SUBSCRIPTION name RENAME TO newname\n\n### DESCRIPTION\n\nALTER SUBSCRIPTION can change most of the subscription properties that can be specified in\nCREATE SUBSCRIPTION (CREATESUBSCRIPTION(7)).\n\nYou must own the subscription to use ALTER SUBSCRIPTION. To alter the owner, you must also be\na direct or indirect member of the new owning role. The new owner has to be a superuser.\n(Currently, all subscription owners must be superusers, so the owner checks will be bypassed\nin practice. But this might change in the future.)\n\nWhen refreshing a publication we remove the relations that are no longer part of the\npublication and we also remove the table synchronization slots if there are any. It is\nnecessary to remove these slots so that the resources allocated for the subscription on the\nremote host are released. If due to network breakdown or some other error, PostgreSQL is\nunable to remove the slots, an ERROR will be reported. To proceed in this situation, the user\neither needs to retry the operation or disassociate the slot from the subscription and drop\nthe subscription as explained in DROP SUBSCRIPTION (DROPSUBSCRIPTION(7)).\n\nCommands ALTER SUBSCRIPTION ... REFRESH PUBLICATION and ALTER SUBSCRIPTION ... {SET|ADD|DROP}\nPUBLICATION ...  with refresh option as true cannot be executed inside a transaction block.\n\n### PARAMETERS\n\nname\nThe name of a subscription whose properties are to be altered.\n\nCONNECTION 'conninfo'\nThis clause alters the connection property originally set by CREATE SUBSCRIPTION\n(CREATESUBSCRIPTION(7)). See there for more information.\n\nSET PUBLICATION publicationname\nADD PUBLICATION publicationname\nDROP PUBLICATION publicationname\nChanges the list of subscribed publications.  SET replaces the entire list of\npublications with a new list, ADD adds additional publications to the list of\npublications, and DROP removes the publications from the list of publications. See CREATE\nSUBSCRIPTION (CREATESUBSCRIPTION(7)) for more information. By default, this command will\nalso act like REFRESH PUBLICATION.\n\npublicationoption specifies additional options for this operation. The supported options\nare:\n\nrefresh (boolean)\nWhen false, the command will not try to refresh table information.  REFRESH\nPUBLICATION should then be executed separately. The default is true.\n\nAdditionally, the options described under REFRESH PUBLICATION may be specified, to\ncontrol the implicit refresh operation.\n\nREFRESH PUBLICATION\nFetch missing table information from publisher. This will start replication of tables\nthat were added to the subscribed-to publications since the last invocation of REFRESH\nPUBLICATION or since CREATE SUBSCRIPTION.\n\nrefreshoption specifies additional options for the refresh operation. The supported\noptions are:\n\ncopydata (boolean)\nSpecifies whether the existing data in the publications that are being subscribed to\nshould be copied once the replication starts. The default is true. (Previously\nsubscribed tables are not copied.)\n\nENABLE\nEnables the previously disabled subscription, starting the logical replication worker at\nthe end of transaction.\n\nDISABLE\nDisables the running subscription, stopping the logical replication worker at the end of\ntransaction.\n\nSET ( subscriptionparameter [= value] [, ... ] )\nThis clause alters parameters originally set by CREATE SUBSCRIPTION\n(CREATESUBSCRIPTION(7)). See there for more information. The parameters that can be\naltered are slotname, synchronouscommit, binary, and streaming.\n\nnewowner\nThe user name of the new owner of the subscription.\n\nnewname\nThe new name for the subscription.\n\n### EXAMPLES\n\nChange the publication subscribed by a subscription to insertonly:\n\nALTER SUBSCRIPTION mysub SET PUBLICATION insertonly;\n\nDisable (stop) the subscription:\n\nALTER SUBSCRIPTION mysub DISABLE;\n\n### COMPATIBILITY\n\nALTER SUBSCRIPTION is a PostgreSQL extension.\n\n### SEE ALSO\n\nCREATE SUBSCRIPTION (CREATESUBSCRIPTION(7)), DROP SUBSCRIPTION (DROPSUBSCRIPTION(7)),\nCREATE PUBLICATION (CREATEPUBLICATION(7)), ALTER PUBLICATION (ALTERPUBLICATION(7))\n\n\n\nPostgreSQL 14.23                                2026                           ALTER SUBSCRIPTION(7)\n\n"
        }
    ],
    "structuredContent": {
        "command": "ALTER_SUBSCRIPTION",
        "section": "7",
        "mode": "man",
        "summary": "ALTERSUBSCRIPTION - change the definition of a subscription",
        "synopsis": "ALTER SUBSCRIPTION name CONNECTION 'conninfo'\nALTER SUBSCRIPTION name SET PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ADD PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name DROP PUBLICATION publicationname [, ...] [ WITH ( publicationoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refreshoption [= value] [, ... ] ) ]\nALTER SUBSCRIPTION name ENABLE\nALTER SUBSCRIPTION name DISABLE\nALTER SUBSCRIPTION name SET ( subscriptionparameter [= value] [, ... ] )\nALTER SUBSCRIPTION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER SUBSCRIPTION name RENAME TO newname",
        "flags": [],
        "examples": [
            "Change the publication subscribed by a subscription to insertonly:",
            "ALTER SUBSCRIPTION mysub SET PUBLICATION insertonly;",
            "Disable (stop) the subscription:",
            "ALTER SUBSCRIPTION mysub DISABLE;"
        ],
        "see_also": [
            {
                "name": "CREATESUBSCRIPTION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATESUBSCRIPTION/7/json"
            },
            {
                "name": "DROPSUBSCRIPTION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/DROPSUBSCRIPTION/7/json"
            },
            {
                "name": "CREATEPUBLICATION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEPUBLICATION/7/json"
            },
            {
                "name": "ALTERPUBLICATION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/ALTERPUBLICATION/7/json"
            },
            {
                "name": "SUBSCRIPTION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 58,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            }
        ]
    }
}