{
    "mode": "man",
    "parameter": "DROP_SUBSCRIPTION",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/DROP_SUBSCRIPTION/7/json",
    "generated": "2026-06-15T14:34:44Z",
    "synopsis": "DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]",
    "sections": {
        "NAME": {
            "content": "DROPSUBSCRIPTION - remove a subscription\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "DROP SUBSCRIPTION removes a subscription from the database cluster.\n\nA subscription can only be dropped by a superuser.\n\nDROP SUBSCRIPTION cannot be executed inside a transaction block if the subscription is\nassociated with a replication slot. (You can use ALTER SUBSCRIPTION to unset the slot.)\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "IF EXISTS\nDo not throw an error if the subscription does not exist. A notice is issued in this\ncase.\n\nname\nThe name of a subscription to be dropped.\n\nCASCADE\nRESTRICT\nThese key words do not have any effect, since there are no dependencies on subscriptions.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "When dropping a subscription that is associated with a replication slot on the remote host\n(the normal state), DROP SUBSCRIPTION will connect to the remote host and try to drop the\nreplication slot (and any remaining table synchronization slots) as part of its operation.\nThis is necessary so that the resources allocated for the subscription on the remote host are\nreleased. If this fails, either because the remote host is not reachable or because the\nremote replication slot cannot be dropped or does not exist or never existed, the DROP\nSUBSCRIPTION command will fail. To proceed in this situation, first disable the subscription\nby executing ALTER SUBSCRIPTION ... DISABLE, and then disassociate it from the replication\nslot by executing ALTER SUBSCRIPTION ... SET (slotname = NONE). After that, DROP\nSUBSCRIPTION will no longer attempt any actions on a remote host. Note that if the remote\nreplication slot still exists, it (and any related table synchronization slots) should then\nbe dropped manually; otherwise it/they will continue to reserve WAL and might eventually\ncause the disk to fill up. See also Section 31.2.1.\n\nIf a subscription is associated with a replication slot, then DROP SUBSCRIPTION cannot be\nexecuted inside a transaction block.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Drop a subscription:\n\nDROP SUBSCRIPTION mysub;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "DROP SUBSCRIPTION is a PostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CREATE SUBSCRIPTION (CREATESUBSCRIPTION(7)), ALTER SUBSCRIPTION (ALTERSUBSCRIPTION(7))\n\n\n\nPostgreSQL 14.23                                2026                            DROP SUBSCRIPTION(7)",
            "subsections": []
        }
    },
    "summary": "DROPSUBSCRIPTION - remove a subscription",
    "flags": [],
    "examples": [
        "Drop a subscription:",
        "DROP SUBSCRIPTION mysub;"
    ],
    "see_also": [
        {
            "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": "SUBSCRIPTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/SUBSCRIPTION/7/json"
        }
    ]
}