]> begriffs open source - ai-pg/blob - full-docs/man7/DISCARD.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DISCARD.7
1 '\" t
2 .\"     Title: DISCARD
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DISCARD" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DISCARD \- discard session state
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBDISCARD\fR
40 releases internal resources associated with a database session\&. This command is useful for partially or fully resetting the session\*(Aqs state\&. There are several subcommands to release different types of resources; the
41 \fBDISCARD ALL\fR
42 variant subsumes all the others, and also resets additional state\&.
43 .SH "PARAMETERS"
44 .PP
45 PLANS
46 .RS 4
47 Releases all cached query plans, forcing re\-planning to occur the next time the associated prepared statement is used\&.
48 .RE
49 .PP
50 SEQUENCES
51 .RS 4
52 Discards all cached sequence\-related state, including
53 \fBcurrval()\fR/\fBlastval()\fR
54 information and any preallocated sequence values that have not yet been returned by
55 \fBnextval()\fR\&. (See
56 CREATE SEQUENCE (\fBCREATE_SEQUENCE\fR(7))
57 for a description of preallocated sequence values\&.)
58 .RE
59 .PP
60 TEMPORARY or TEMP
61 .RS 4
62 Drops all temporary tables created in the current session\&.
63 .RE
64 .PP
65 ALL
66 .RS 4
67 Releases all temporary resources associated with the current session and resets the session to its initial state\&. Currently, this has the same effect as executing the following sequence of statements:
68 .sp
69 .if n \{\
70 .RS 4
71 .\}
72 .nf
73 CLOSE ALL;
74 SET SESSION AUTHORIZATION DEFAULT;
75 RESET ALL;
76 DEALLOCATE ALL;
77 UNLISTEN *;
78 SELECT pg_advisory_unlock_all();
79 DISCARD PLANS;
80 DISCARD TEMP;
81 DISCARD SEQUENCES;
82 .fi
83 .if n \{\
84 .RE
85 .\}
86 .RE
87 .SH "NOTES"
88 .PP
89 \fBDISCARD ALL\fR
90 cannot be executed inside a transaction block\&.
91 .SH "COMPATIBILITY"
92 .PP
93 \fBDISCARD\fR
94 is a
95 PostgreSQL
96 extension\&.