1DISCARD(7)               PostgreSQL 13.4 Documentation              DISCARD(7)
2
3
4

NAME

6       DISCARD - discard session state
7

SYNOPSIS

9       DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
10

DESCRIPTION

12       DISCARD releases internal resources associated with a database session.
13       This command is useful for partially or fully resetting the session's
14       state. There are several subcommands to release different types of
15       resources; the DISCARD ALL variant subsumes all the others, and also
16       resets additional state.
17

PARAMETERS

19       PLANS
20           Releases all cached query plans, forcing re-planning to occur the
21           next time the associated prepared statement is used.
22
23       SEQUENCES
24           Discards all cached sequence-related state, including
25           currval()/lastval() information and any preallocated sequence
26           values that have not yet been returned by nextval(). (See CREATE
27           SEQUENCE (CREATE_SEQUENCE(7)) for a description of preallocated
28           sequence values.)
29
30       TEMPORARY or TEMP
31           Drops all temporary tables created in the current session.
32
33       ALL
34           Releases all temporary resources associated with the current
35           session and resets the session to its initial state. Currently,
36           this has the same effect as executing the following sequence of
37           statements:
38
39               CLOSE ALL;
40               SET SESSION AUTHORIZATION DEFAULT;
41               RESET ALL;
42               DEALLOCATE ALL;
43               UNLISTEN *;
44               SELECT pg_advisory_unlock_all();
45               DISCARD PLANS;
46               DISCARD TEMP;
47               DISCARD SEQUENCES;
48

NOTES

50       DISCARD ALL cannot be executed inside a transaction block.
51

COMPATIBILITY

53       DISCARD is a PostgreSQL extension.
54
55
56
57PostgreSQL 13.4                      2021                           DISCARD(7)
Impressum