Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 259904e

Browse files
committed
Improve DISCARD documentation.
The new DISCARD SEQUENCES option was inadequately described, and hadn't been mentioned at all in the initial Description paragraph. Rather than rectifying the latter the hard way, it seemed better to rewrite the description as a summary, instead of having it basically duplicate statements made under Parameters. Be more consistent about the ordering of the options, too.
1 parent 1330e29 commit 259904e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/src/sgml/ref/discard.sgml

+17-17
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
3030

3131
<para>
3232
<command>DISCARD</> releases internal resources associated with a
33-
database session. These resources are normally released at the end
34-
of the session.
35-
</para>
36-
37-
<para>
38-
<command>DISCARD TEMP</> drops all temporary tables created in the
39-
current session. <command>DISCARD PLANS</> releases all internally
40-
cached query plans. <command>DISCARD ALL</> resets a session to
41-
its original state, discarding temporary resources and resetting
42-
session-local configuration changes.
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</>
36+
variant subsumes all the others, and also resets additional state.
4337
</para>
4438
</refsect1>
4539

@@ -49,28 +43,34 @@ DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
4943
<variablelist>
5044

5145
<varlistentry>
52-
<term><literal>TEMPORARY</literal> or <literal>TEMP</literal></term>
46+
<term><literal>PLANS</literal></term>
5347
<listitem>
5448
<para>
55-
Drops all temporary tables created in the current session.
49+
Releases all cached query plans, forcing re-planning to occur
50+
the next time the associated prepared statement is used.
5651
</para>
5752
</listitem>
5853
</varlistentry>
5954

6055
<varlistentry>
61-
<term><literal>PLANS</literal></term>
56+
<term><literal>SEQUENCES</literal></term>
6257
<listitem>
6358
<para>
64-
Releases all cached query plans.
59+
Discards all cached sequence-related state,
60+
including <function>currval()</>/<function>lastval()</>
61+
information and any preallocated sequence values that have not
62+
yet been returned by <function>nextval()</>.
63+
(See <xref linkend="sql-createsequence"> for a description of
64+
preallocated sequence values.)
6565
</para>
6666
</listitem>
6767
</varlistentry>
6868

6969
<varlistentry>
70-
<term><literal>SEQUENCES</literal></term>
70+
<term><literal>TEMPORARY</literal> or <literal>TEMP</literal></term>
7171
<listitem>
7272
<para>
73-
Discards all cached sequence values.
73+
Drops all temporary tables created in the current session.
7474
</para>
7575
</listitem>
7676
</varlistentry>
@@ -91,8 +91,8 @@ CLOSE ALL;
9191
UNLISTEN *;
9292
SELECT pg_advisory_unlock_all();
9393
DISCARD PLANS;
94-
DISCARD TEMP;
9594
DISCARD SEQUENCES;
95+
DISCARD TEMP;
9696
</programlisting></para>
9797
</listitem>
9898
</varlistentry>

0 commit comments

Comments
 (0)