{
    "mode": "man",
    "parameter": "DISCARD",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/DISCARD/7/json",
    "generated": "2026-10-10T09:00:28Z",
    "synopsis": "DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }",
    "sections": {
        "NAME": {
            "content": "DISCARD - discard session state\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "DISCARD releases internal resources associated with a database session. This command is\nuseful for partially or fully resetting the session's state. There are several subcommands to\nrelease different types of resources; the DISCARD ALL variant subsumes all the others, and\nalso resets additional state.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "PLANS\nReleases all cached query plans, forcing re-planning to occur the next time the\nassociated prepared statement is used.\n\nSEQUENCES\nDiscards all cached sequence-related state, including currval()/lastval() information and\nany preallocated sequence values that have not yet been returned by nextval(). (See\nCREATE SEQUENCE (CREATESEQUENCE(7)) for a description of preallocated sequence values.)\n\nTEMPORARY or TEMP\nDrops all temporary tables created in the current session.\n\nALL\nReleases all temporary resources associated with the current session and resets the\nsession to its initial state. Currently, this has the same effect as executing the\nfollowing sequence of statements:\n\nCLOSE ALL;\nSET SESSION AUTHORIZATION DEFAULT;\nRESET ALL;\nDEALLOCATE ALL;\nUNLISTEN *;\nSELECT pgadvisoryunlockall();\nDISCARD PLANS;\nDISCARD TEMP;\nDISCARD SEQUENCES;\n",
            "subsections": []
        },
        "NOTES": {
            "content": "DISCARD ALL cannot be executed inside a transaction block.\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "DISCARD is a PostgreSQL extension.\n\nPostgreSQL 16.14                                2026                                      DISCARD(7)",
            "subsections": []
        }
    },
    "summary": "DISCARD - discard session state",
    "flags": [],
    "examples": [],
    "see_also": []
}