{
    "mode": "man",
    "parameter": "ROLLBACK_PREPARED",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ROLLBACK_PREPARED/7/json",
    "generated": "2026-07-05T13:23:14Z",
    "synopsis": "ROLLBACK PREPARED transactionid",
    "sections": {
        "NAME": {
            "content": "ROLLBACKPREPARED - cancel a transaction that was earlier prepared for two-phase commit\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ROLLBACK PREPARED transactionid\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ROLLBACK PREPARED rolls back a transaction that is in prepared state.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "transactionid\nThe transaction identifier of the transaction that is to be rolled back.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "To roll back a prepared transaction, you must be either the same user that executed the\ntransaction originally, or a superuser. But you do not have to be in the same session that\nexecuted the transaction.\n\nThis command cannot be executed inside a transaction block. The prepared transaction is\nrolled back immediately.\n\nAll currently available prepared transactions are listed in the pgpreparedxacts system\nview.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Roll back the transaction identified by the transaction identifier foobar:\n\nROLLBACK PREPARED 'foobar';\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "ROLLBACK PREPARED is a PostgreSQL extension. It is intended for use by external transaction\nmanagement systems, some of which are covered by standards (such as X/Open XA), but the SQL\nside of those systems is not standardized.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "PREPARE TRANSACTION (PREPARETRANSACTION(7)), COMMIT PREPARED (COMMITPREPARED(7))\n\n\n\nPostgreSQL 14.23                                2026                            ROLLBACK PREPARED(7)",
            "subsections": []
        }
    },
    "summary": "ROLLBACKPREPARED - cancel a transaction that was earlier prepared for two-phase commit",
    "flags": [],
    "examples": [
        "Roll back the transaction identified by the transaction identifier foobar:",
        "ROLLBACK PREPARED 'foobar';"
    ],
    "see_also": [
        {
            "name": "PREPARETRANSACTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/PREPARETRANSACTION/7/json"
        },
        {
            "name": "COMMITPREPARED",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/COMMITPREPARED/7/json"
        },
        {
            "name": "PREPARED",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/PREPARED/7/json"
        }
    ]
}