From: Tom Lane Date: Thu, 27 Nov 2008 00:34:49 +0000 (+0000) Subject: Back-patch change to make DISCARD ALL release advisory locks. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=37b1ceac86096e39c616c4c0383cb0b6d27e2092;p=users%2Fbernd%2Fpostgres.git Back-patch change to make DISCARD ALL release advisory locks. Per discussion. --- diff --git a/doc/src/sgml/ref/discard.sgml b/doc/src/sgml/ref/discard.sgml index b93efdcfbd..0da118fc06 100644 --- a/doc/src/sgml/ref/discard.sgml +++ b/doc/src/sgml/ref/discard.sgml @@ -70,15 +70,16 @@ DISCARD { ALL | PLANS | TEMPORARY | TEMP } Releases all temporary resources associated with the current - session and resets the session to its initial state. This has - the same effect as executing the following sequence of - statements: + session and resets the session to its initial state. + Currently, this has the same effect as executing the following sequence + of statements: SET SESSION AUTHORIZATION DEFAULT; RESET ALL; DEALLOCATE ALL; CLOSE ALL; UNLISTEN *; +SELECT pg_advisory_unlock_all(); DISCARD PLANS; DISCARD TEMP; diff --git a/src/backend/commands/discard.c b/src/backend/commands/discard.c index d7bddbde98..c889598781 100644 --- a/src/backend/commands/discard.c +++ b/src/backend/commands/discard.c @@ -19,6 +19,7 @@ #include "commands/discard.h" #include "commands/prepare.h" #include "commands/variable.h" +#include "storage/lock.h" #include "utils/plancache.h" #include "utils/portal.h" @@ -66,6 +67,7 @@ DiscardAll(bool isTopLevel) DropAllPreparedStatements(); PortalHashTableDeleteAll(); Async_UnlistenAll(); + LockReleaseAll(USER_LOCKMETHOD, true); ResetPlanCache(); ResetTempTableNamespace(); }