#include "postgres.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "commands/async.h"
#include "commands/discard.h"
#include "commands/prepare.h"
#include "utils/guc.h"
#include "utils/portal.h"
Go to the source code of this file.
Functions | |
static void | DiscardAll (bool isTopLevel) |
void | DiscardCommand (DiscardStmt *stmt, bool isTopLevel) |
static void DiscardAll | ( | bool | isTopLevel | ) | [static] |
Definition at line 52 of file discard.c.
References Async_UnlistenAll(), DropAllPreparedStatements(), LockReleaseAll(), NIL, PortalHashTableDeleteAll(), PreventTransactionChain(), ResetAllOptions(), ResetPlanCache(), ResetTempTableNamespace(), SetPGVariable(), and USER_LOCKMETHOD.
Referenced by DiscardCommand().
{ /* * Disallow DISCARD ALL in a transaction block. This is arguably * inconsistent (we don't make a similar check in the command sequence * that DISCARD ALL is equivalent to), but the idea is to catch mistakes: * DISCARD ALL inside a transaction block would leave the transaction * still uncommitted. */ PreventTransactionChain(isTopLevel, "DISCARD ALL"); /* Closing portals might run user-defined code, so do that first. */ PortalHashTableDeleteAll(); SetPGVariable("session_authorization", NIL, false); ResetAllOptions(); DropAllPreparedStatements(); Async_UnlistenAll(); LockReleaseAll(USER_LOCKMETHOD, true); ResetPlanCache(); ResetTempTableNamespace(); }
void DiscardCommand | ( | DiscardStmt * | stmt, | |
bool | isTopLevel | |||
) |
Definition at line 30 of file discard.c.
References DISCARD_ALL, DISCARD_PLANS, DISCARD_TEMP, DiscardAll(), elog, ERROR, ResetPlanCache(), ResetTempTableNamespace(), and DiscardStmt::target.
Referenced by standard_ProcessUtility().
{ switch (stmt->target) { case DISCARD_ALL: DiscardAll(isTopLevel); break; case DISCARD_PLANS: ResetPlanCache(); break; case DISCARD_TEMP: ResetTempTableNamespace(); break; default: elog(ERROR, "unrecognized DISCARD target: %d", stmt->target); } }