2 doc/src/sgml/ref/discard.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-discard">
7 <indexterm zone=
"sql-discard">
8 <primary>DISCARD
</primary>
12 <refentrytitle>DISCARD
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>DISCARD
</refname>
19 <refpurpose>discard session state
</refpurpose>
24 DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
29 <title>Description
</title>
32 <command>DISCARD
</command> releases internal resources associated with a
33 database session. This command is useful for partially or fully
34 resetting the session's state. There are several subcommands to
35 release different types of resources; the
<command>DISCARD ALL
</command>
36 variant subsumes all the others, and also resets additional state.
41 <title>Parameters
</title>
46 <term><literal>PLANS
</literal></term>
49 Releases all cached query plans, forcing re-planning to occur
50 the next time the associated prepared statement is used.
56 <term><literal>SEQUENCES
</literal></term>
59 Discards all cached sequence-related state,
60 including
<function>currval()
</function>/
<function>lastval()
</function>
61 information and any preallocated sequence values that have not
62 yet been returned by
<function>nextval()
</function>.
63 (See
<xref linkend=
"sql-createsequence"/> for a description of
64 preallocated sequence values.)
70 <term><literal>TEMPORARY
</literal> or
<literal>TEMP
</literal></term>
73 Drops all temporary tables created in the current session.
79 <term><literal>ALL
</literal></term>
82 Releases all temporary resources associated with the current
83 session and resets the session to its initial state.
84 Currently, this has the same effect as executing the following sequence
88 SET SESSION AUTHORIZATION DEFAULT;
92 SELECT pg_advisory_unlock_all();
96 </programlisting></para>
107 <command>DISCARD ALL
</command> cannot be executed inside a transaction block.
112 <title>Compatibility
</title>
115 <command>DISCARD
</command> is a
<productname>PostgreSQL
</productname> extension.