{
    "mode": "man",
    "parameter": "ROLLBACK",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ROLLBACK/7/json",
    "generated": "2026-10-08T01:43:44Z",
    "synopsis": "ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]",
    "sections": {
        "NAME": {
            "content": "ROLLBACK - abort the current transaction\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ROLLBACK rolls back the current transaction and causes all the updates made by the\ntransaction to be discarded.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "WORK\nTRANSACTION\nOptional key words. They have no effect.\n\nAND CHAIN\nIf AND CHAIN is specified, a new (not aborted) transaction is immediately started with\nthe same transaction characteristics (see SET TRANSACTION (SETTRANSACTION(7))) as the\njust finished one. Otherwise, no new transaction is started.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "Use COMMIT to successfully terminate a transaction.\n\nIssuing ROLLBACK outside of a transaction block emits a warning and otherwise has no effect.\nROLLBACK AND CHAIN outside of a transaction block is an error.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "To abort all changes:\n\nROLLBACK;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "The command ROLLBACK conforms to the SQL standard. The form ROLLBACK TRANSACTION is a\nPostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "BEGIN(7), COMMIT(7), ROLLBACK TO SAVEPOINT (ROLLBACKTOSAVEPOINT(7))\n\nPostgreSQL 16.14                                2026                                     ROLLBACK(7)",
            "subsections": []
        }
    },
    "summary": "ROLLBACK - abort the current transaction",
    "flags": [],
    "examples": [
        "To abort all changes:",
        "ROLLBACK;"
    ],
    "see_also": [
        {
            "name": "BEGIN",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/BEGIN/7/json"
        },
        {
            "name": "COMMIT",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/COMMIT/7/json"
        },
        {
            "name": "ROLLBACKTOSAVEPOINT",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/ROLLBACKTOSAVEPOINT/7/json"
        }
    ]
}