]> begriffs open source - ai-pg/blob - full-docs/txt/sql-discard.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-discard.txt
1
2 DISCARD
3
4    DISCARD — discard session state
5
6 Synopsis
7
8 DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
9
10 Description
11
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
18 Parameters
19
20    PLANS
21           Releases all cached query plans, forcing re-planning to occur
22           the next time the associated prepared statement is used.
23
24    SEQUENCES
25           Discards all cached sequence-related state, including
26           currval()/lastval() information and any preallocated sequence
27           values that have not yet been returned by nextval(). (See CREATE
28           SEQUENCE for a description of preallocated 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
49 Notes
50
51    DISCARD ALL cannot be executed inside a transaction block.
52
53 Compatibility
54
55    DISCARD is a PostgreSQL extension.