'\" t .\" Title: DISCARD .\" Author: The PostgreSQL Global Development Group .\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: 2016 .\" Manual: PostgreSQL 9.5.2 Documentation .\" Source: PostgreSQL 9.5.2 .\" Language: English .\" .TH "DISCARD" "5sql" "2016" "PostgreSQL 9.5.2" "PostgreSQL 9.5.2 Documentation" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" DISCARD \- discard session state .SH "SYNOPSIS" .sp .nf DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP } .fi .SH "DESCRIPTION" .PP \fBDISCARD\fR 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 \fBDISCARD ALL\fR variant subsumes all the others, and also resets additional state\&. .SH "PARAMETERS" .PP PLANS .RS 4 Releases all cached query plans, forcing re\-planning to occur the next time the associated prepared statement is used\&. .RE .PP SEQUENCES .RS 4 Discards all cached sequence\-related state, including \fBcurrval()\fR/\fBlastval()\fR information and any preallocated sequence values that have not yet been returned by \fBnextval()\fR\&. (See CREATE SEQUENCE (\fBCREATE_SEQUENCE\fR(5)) for a description of preallocated sequence values\&.) .RE .PP TEMPORARY or TEMP .RS 4 Drops all temporary tables created in the current session\&. .RE .PP ALL .RS 4 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: .sp .if n \{\ .RS 4 .\} .nf SET SESSION AUTHORIZATION DEFAULT; RESET ALL; DEALLOCATE ALL; CLOSE ALL; UNLISTEN *; SELECT pg_advisory_unlock_all(); DISCARD PLANS; DISCARD SEQUENCES; DISCARD TEMP; .fi .if n \{\ .RE .\} .RE .SH "NOTES" .PP \fBDISCARD ALL\fR cannot be executed inside a transaction block\&. .SH "COMPATIBILITY" .PP \fBDISCARD\fR is a PostgreSQL extension\&.