{
    "mode": "man",
    "parameter": "CLOSE",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/CLOSE/7/json",
    "generated": "2026-06-15T16:01:02Z",
    "synopsis": "CLOSE { name | ALL }",
    "sections": {
        "NAME": {
            "content": "CLOSE - close a cursor\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "CLOSE { name | ALL }\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "CLOSE frees the resources associated with an open cursor. After the cursor is closed, no\nsubsequent operations are allowed on it. A cursor should be closed when it is no longer\nneeded.\n\nEvery non-holdable open cursor is implicitly closed when a transaction is terminated by\nCOMMIT or ROLLBACK. A holdable cursor is implicitly closed if the transaction that created it\naborts via ROLLBACK. If the creating transaction successfully commits, the holdable cursor\nremains open until an explicit CLOSE is executed, or the client disconnects.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name of an open cursor to close.\n\nALL\nClose all open cursors.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "PostgreSQL does not have an explicit OPEN cursor statement; a cursor is considered open when\nit is declared. Use the DECLARE statement to declare a cursor.\n\nYou can see all available cursors by querying the pgcursors system view.\n\nIf a cursor is closed after a savepoint which is later rolled back, the CLOSE is not rolled\nback; that is, the cursor remains closed.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Close the cursor liahona:\n\nCLOSE liahona;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "CLOSE is fully conforming with the SQL standard.  CLOSE ALL is a PostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "DECLARE(7), FETCH(7), MOVE(7)\n\n\n\nPostgreSQL 14.23                                2026                                        CLOSE(7)",
            "subsections": []
        }
    },
    "summary": "CLOSE - close a cursor",
    "flags": [],
    "examples": [
        "Close the cursor liahona:",
        "CLOSE liahona;"
    ],
    "see_also": [
        {
            "name": "DECLARE",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DECLARE/7/json"
        },
        {
            "name": "FETCH",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/FETCH/7/json"
        },
        {
            "name": "MOVE",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/MOVE/7/json"
        }
    ]
}