Back-patch change to make DISCARD ALL release advisory locks.

Per discussion.
This commit is contained in:
Tom Lane 2008-11-27 00:34:49 +00:00
parent 0b1953868e
commit b9e8986d1b
2 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/discard.sgml,v 1.2 2007/04/26 18:00:24 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/discard.sgml,v 1.2.2.1 2008/11/27 00:34:49 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
@ -70,15 +70,16 @@ DISCARD { ALL | PLANS | TEMPORARY | TEMP }
<listitem> <listitem>
<para> <para>
Releases all temporary resources associated with the current Releases all temporary resources associated with the current
session and resets the session to its initial state. This has session and resets the session to its initial state.
the same effect as executing the following sequence of Currently, this has the same effect as executing the following sequence
statements: of statements:
<programlisting> <programlisting>
SET SESSION AUTHORIZATION DEFAULT; SET SESSION AUTHORIZATION DEFAULT;
RESET ALL; RESET ALL;
DEALLOCATE ALL; DEALLOCATE ALL;
CLOSE ALL; CLOSE ALL;
UNLISTEN *; UNLISTEN *;
SELECT pg_advisory_unlock_all();
DISCARD PLANS; DISCARD PLANS;
DISCARD TEMP; DISCARD TEMP;
</programlisting> </programlisting>

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/discard.c,v 1.4 2008/01/01 19:45:49 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/discard.c,v 1.4.2.1 2008/11/27 00:34:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -19,6 +19,7 @@
#include "commands/discard.h" #include "commands/discard.h"
#include "commands/prepare.h" #include "commands/prepare.h"
#include "commands/variable.h" #include "commands/variable.h"
#include "storage/lock.h"
#include "utils/plancache.h" #include "utils/plancache.h"
#include "utils/portal.h" #include "utils/portal.h"
@ -66,6 +67,7 @@ DiscardAll(bool isTopLevel)
DropAllPreparedStatements(); DropAllPreparedStatements();
PortalHashTableDeleteAll(); PortalHashTableDeleteAll();
Async_UnlistenAll(); Async_UnlistenAll();
LockReleaseAll(USER_LOCKMETHOD, true);
ResetPlanCache(); ResetPlanCache();
ResetTempTableNamespace(); ResetTempTableNamespace();
} }