summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/ref/discard.sgml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /doc/src/sgml/ref/discard.sgml
parentInitial commit. (diff)
downloadpostgresql-14-upstream.tar.xz
postgresql-14-upstream.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--doc/src/sgml/ref/discard.sgml118
1 files changed, 118 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/discard.sgml b/doc/src/sgml/ref/discard.sgml
new file mode 100644
index 0000000..bf44c52
--- /dev/null
+++ b/doc/src/sgml/ref/discard.sgml
@@ -0,0 +1,118 @@
+<!--
+doc/src/sgml/ref/discard.sgml
+PostgreSQL documentation
+-->
+
+<refentry id="sql-discard">
+ <indexterm zone="sql-discard">
+ <primary>DISCARD</primary>
+ </indexterm>
+
+ <refmeta>
+ <refentrytitle>DISCARD</refentrytitle>
+ <manvolnum>7</manvolnum>
+ <refmiscinfo>SQL - Language Statements</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>DISCARD</refname>
+ <refpurpose>discard session state</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+<synopsis>
+DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
+</synopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>
+ <command>DISCARD</command> releases internal resources associated with a
+ database session. This command is useful for partially or fully
+ resetting the session's state. There are several subcommands to
+ release different types of resources; the <command>DISCARD ALL</command>
+ variant subsumes all the others, and also resets additional state.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Parameters</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><literal>PLANS</literal></term>
+ <listitem>
+ <para>
+ Releases all cached query plans, forcing re-planning to occur
+ the next time the associated prepared statement is used.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>SEQUENCES</literal></term>
+ <listitem>
+ <para>
+ Discards all cached sequence-related state,
+ including <function>currval()</function>/<function>lastval()</function>
+ information and any preallocated sequence values that have not
+ yet been returned by <function>nextval()</function>.
+ (See <xref linkend="sql-createsequence"/> for a description of
+ preallocated sequence values.)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>TEMPORARY</literal> or <literal>TEMP</literal></term>
+ <listitem>
+ <para>
+ Drops all temporary tables created in the current session.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ALL</literal></term>
+ <listitem>
+ <para>
+ 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:
+<programlisting>
+CLOSE ALL;
+SET SESSION AUTHORIZATION DEFAULT;
+RESET ALL;
+DEALLOCATE ALL;
+UNLISTEN *;
+SELECT pg_advisory_unlock_all();
+DISCARD PLANS;
+DISCARD TEMP;
+DISCARD SEQUENCES;
+</programlisting></para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Notes</title>
+
+ <para>
+ <command>DISCARD ALL</command> cannot be executed inside a transaction block.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Compatibility</title>
+
+ <para>
+ <command>DISCARD</command> is a <productname>PostgreSQL</productname> extension.
+ </para>
+ </refsect1>
+</refentry>