{
    "mode": "man",
    "parameter": "ALTER_SUBSCRIPTION",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ALTER_SUBSCRIPTION/7/json",
    "generated": "2026-10-09T17:05:28Z",
    "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 SKIP ( skipoption = value )\nALTER SUBSCRIPTION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER SUBSCRIPTION name RENAME TO newname",
    "sections": {
        "NAME": {
            "content": "ALTERSUBSCRIPTION - change the definition of a subscription\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "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 SKIP ( skipoption = value )\nALTER SUBSCRIPTION name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER SUBSCRIPTION name RENAME TO newname\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ALTER 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 rename a subscription or alter\nthe owner, you must have CREATE permission on the database. In addition, to alter the owner,\nyou must be able to SET ROLE to the new owning role. If the subscription has\npasswordrequired=false, only superusers can modify it.\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.\nThese commands also cannot be executed when the subscription has twophase commit enabled,\nunless copydata is false. See column subtwophasestate of pgsubscription to know the actual\ntwo-phase state.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name of a subscription whose properties are to be altered.\n\nCONNECTION 'conninfo'\nThis clause replaces the connection string originally set by CREATE SUBSCRIPTION\n(CREATESUBSCRIPTION(7)). See there for more information.\n\nSET PUBLICATION publicationname\nADD PUBLICATION publicationname\nDROP PUBLICATION publicationname\nThese forms change 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. We allow\nnon-existent publications to be specified in ADD and SET variants so that users can add\nthose later. See CREATE SUBSCRIPTION (CREATESUBSCRIPTION(7)) for more information. By\ndefault, this command will also 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 CREATE SUBSCRIPTION or the last\ninvocation of REFRESH PUBLICATION.\n\nrefreshoption specifies additional options for the refresh operation. The supported\noptions are:\n\ncopydata (boolean)\nSpecifies whether to copy pre-existing data in the publications that are being\nsubscribed to when the replication starts. The default is true.\n\nPreviously subscribed tables are not copied, even if a table's row filter WHERE\nclause has since been modified.\n\nSee Notes for details of how copydata = true can interact with the origin parameter.\n\nSee the binary parameter of CREATE SUBSCRIPTION for details about copying\npre-existing data in binary format.\n\nENABLE\nEnables a previously disabled subscription, starting the logical replication worker at\nthe end of the transaction.\n\nDISABLE\nDisables a running subscription, stopping the logical replication worker at the end of\nthe transaction.\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, streaming, disableonerror,\npasswordrequired, runasowner, and origin. Only a superuser can set passwordrequired =\nfalse.\n\nSKIP ( skipoption = value )\nSkips applying all changes of the remote transaction. If incoming data violates any\nconstraints, logical replication will stop until it is resolved. By using the ALTER\nSUBSCRIPTION ... SKIP command, the logical replication worker skips all data modification\nchanges within the transaction. This option has no effect on the transactions that are\nalready prepared by enabling twophase on the subscriber. After the logical replication\nworker successfully skips the transaction or finishes a transaction, the LSN (stored in\npgsubscription.subskiplsn) is cleared. See Section 31.5 for the details of logical\nreplication conflicts.\n\nskipoption specifies options for this operation. The supported option is:\n\nlsn (pglsn)\nSpecifies the finish LSN of the remote transaction whose changes are to be skipped by\nthe logical replication worker. The finish LSN is the LSN at which the transaction is\neither committed or prepared. Skipping individual subtransactions is not supported.\nSetting NONE resets the LSN.\n\nnewowner\nThe user name of the new owner of the subscription.\n\nnewname\nThe new name for the subscription.\n\nWhen specifying a parameter of type boolean, the = value part can be omitted, which is\nequivalent to specifying TRUE.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Change 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",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "ALTER SUBSCRIPTION is a PostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CREATE SUBSCRIPTION (CREATESUBSCRIPTION(7)), DROP SUBSCRIPTION (DROPSUBSCRIPTION(7)),\nCREATE PUBLICATION (CREATEPUBLICATION(7)), ALTER PUBLICATION (ALTERPUBLICATION(7))\n\nPostgreSQL 16.14                                2026                           ALTER SUBSCRIPTION(7)",
            "subsections": []
        }
    },
    "summary": "ALTERSUBSCRIPTION - change the definition of a subscription",
    "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"
        }
    ]
}