From d13e903beaecd45a3721e4c2a7f9ff842ce94a79 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Thu, 12 Apr 2007 06:53:49 +0000 Subject: RESET SESSION, plus related new DDL commands. Patch from Marko Kreen, reviewed by Neil Conway. This patch adds the following DDL command variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and DEALLOCATE ALL. RESET SESSION is intended for use by connection pool software and the like, in order to reset a client session to something close to its initial state. Note that while most of these command variants can be executed inside a transaction block (but are not transaction-aware!), RESET SESSION cannot. While this is inconsistent, it is intended to catch programmer mistakes: RESET SESSION in an open transaction block is probably unintended. --- doc/src/sgml/ref/close.sgml | 26 ++++++++++++----- doc/src/sgml/ref/deallocate.sgml | 13 +++++++-- doc/src/sgml/ref/reset.sgml | 63 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 90 insertions(+), 12 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/close.sgml b/doc/src/sgml/ref/close.sgml index f3f37d95f66..2e5309ff0f2 100644 --- a/doc/src/sgml/ref/close.sgml +++ b/doc/src/sgml/ref/close.sgml @@ -1,5 +1,5 @@ @@ -25,7 +25,7 @@ PostgreSQL documentation -CLOSE name +CLOSE { name | ALL } @@ -44,10 +44,10 @@ CLOSE name transaction is terminated by COMMIT or ROLLBACK. A holdable cursor is implicitly closed if the transaction that created it aborts via - ROLLBACK. If the creating transaction successfully - commits, the holdable - cursor remains open until an explicit CLOSE is - executed, or the client disconnects. + ROLLBACK. If the creating transaction + successfully commits, the holdable cursor remains open until an + explicit CLOSE is executed, or the client + disconnects. @@ -63,6 +63,16 @@ CLOSE name + + + ALL + + + Close all open cursors. + + + + @@ -98,7 +108,9 @@ CLOSE liahona; Compatibility - CLOSE is fully conforming with the SQL standard. + CLOSE is fully conforming with the SQL + standard. CLOSE ALL is a PostgreSQL + extension. diff --git a/doc/src/sgml/ref/deallocate.sgml b/doc/src/sgml/ref/deallocate.sgml index 2038767c0d4..26fee6aa06b 100644 --- a/doc/src/sgml/ref/deallocate.sgml +++ b/doc/src/sgml/ref/deallocate.sgml @@ -1,5 +1,5 @@ @@ -25,7 +25,7 @@ PostgreSQL documentation -DEALLOCATE [ PREPARE ] name +DEALLOCATE [ PREPARE ] { name | ALL } @@ -65,6 +65,15 @@ DEALLOCATE [ PREPARE ] name + + + ALL + + + Deallocate all prepared statements. + + + diff --git a/doc/src/sgml/ref/reset.sgml b/doc/src/sgml/ref/reset.sgml index 84426d2cb6a..e94ef0b8d57 100644 --- a/doc/src/sgml/ref/reset.sgml +++ b/doc/src/sgml/ref/reset.sgml @@ -1,5 +1,5 @@ @@ -22,9 +22,10 @@ PostgreSQL documentation RESET configuration_parameter RESET ALL +RESET { PLANS | SESSION | TEMP | TEMPORARY } - + Description @@ -41,7 +42,7 @@ SET configuration_parameter TO DEFA The default value is defined as the value that the parameter would - have had, had no SET ever been issued for it in the + have had, if no SET ever been issued for it in the current session. The actual source of this value might be a compiled-in default, the configuration file, command-line options, or per-database or per-user default settings. See configuration_parameter TO DEFA See the SET reference page for details on the transaction behavior of RESET. + + + RESET can also be used to release internal resources + that are usually released at the end of session. RESET + TEMP drops all temporary tables created in the current session. + RESET PLANS releases all internally cached plans. + RESET SESSION releases all externally visible temporary + resources associated with the current session. + @@ -76,9 +86,56 @@ SET configuration_parameter TO DEFA + + + TEMP, TEMPORARY + + + Drops all temporary tables created in the current session. + + + + + + PLANS + + + Releases all cached query plans. + + + + + + SESSION + + + Releases all temporary resources associated with the current + session. This has the same effect as executing the following + command sequence: + +SET SESSION AUTHORIZATION DEFAULT; +RESET ALL; +DEALLOCATE ALL; +CLOSE ALL; +UNLISTEN *; +RESET PLANS; +RESET TEMP; + + + + + + + Notes + + + RESET SESSION cannot be executed inside a transaction block. + + + Examples -- cgit v1.2.3