aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/portalcmds.c22
-rw-r--r--src/backend/commands/sequence.c16
-rw-r--r--src/backend/commands/trigger.c36
3 files changed, 22 insertions, 52 deletions
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index b36473fba44..76d6cf154c6 100644
--- a/src/backend/commands/portalcmds.c
+++ b/src/backend/commands/portalcmds.c
@@ -294,21 +294,13 @@ PortalCleanup(Portal portal)
/* We must make the portal's resource owner current */
saveResourceOwner = CurrentResourceOwner;
- PG_TRY();
- {
- if (portal->resowner)
- CurrentResourceOwner = portal->resowner;
- ExecutorFinish(queryDesc);
- ExecutorEnd(queryDesc);
- FreeQueryDesc(queryDesc);
- }
- PG_CATCH();
- {
- /* Ensure CurrentResourceOwner is restored on error */
- CurrentResourceOwner = saveResourceOwner;
- PG_RE_THROW();
- }
- PG_END_TRY();
+ if (portal->resowner)
+ CurrentResourceOwner = portal->resowner;
+
+ ExecutorFinish(queryDesc);
+ ExecutorEnd(queryDesc);
+ FreeQueryDesc(queryDesc);
+
CurrentResourceOwner = saveResourceOwner;
}
}
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 5c2ce789468..5e1b0fe2897 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -1055,18 +1055,10 @@ lock_and_open_sequence(SeqTable seq)
ResourceOwner currentOwner;
currentOwner = CurrentResourceOwner;
- PG_TRY();
- {
- CurrentResourceOwner = TopTransactionResourceOwner;
- LockRelationOid(seq->relid, RowExclusiveLock);
- }
- PG_CATCH();
- {
- /* Ensure CurrentResourceOwner is restored on error */
- CurrentResourceOwner = currentOwner;
- PG_RE_THROW();
- }
- PG_END_TRY();
+ CurrentResourceOwner = TopTransactionResourceOwner;
+
+ LockRelationOid(seq->relid, RowExclusiveLock);
+
CurrentResourceOwner = currentOwner;
/* Flag that we have a lock in the current xact */
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index e75a59d2995..8d0345cd64e 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -3639,17 +3639,10 @@ GetCurrentFDWTuplestore(void)
*/
oldcxt = MemoryContextSwitchTo(CurTransactionContext);
saveResourceOwner = CurrentResourceOwner;
- PG_TRY();
- {
- CurrentResourceOwner = CurTransactionResourceOwner;
- ret = tuplestore_begin_heap(false, false, work_mem);
- }
- PG_CATCH();
- {
- CurrentResourceOwner = saveResourceOwner;
- PG_RE_THROW();
- }
- PG_END_TRY();
+ CurrentResourceOwner = CurTransactionResourceOwner;
+
+ ret = tuplestore_begin_heap(false, false, work_mem);
+
CurrentResourceOwner = saveResourceOwner;
MemoryContextSwitchTo(oldcxt);
@@ -4468,20 +4461,13 @@ MakeTransitionCaptureState(TriggerDesc *trigdesc, Oid relid, CmdType cmdType)
/* Now create required tuplestore(s), if we don't have them already. */
oldcxt = MemoryContextSwitchTo(CurTransactionContext);
saveResourceOwner = CurrentResourceOwner;
- PG_TRY();
- {
- CurrentResourceOwner = CurTransactionResourceOwner;
- if (need_old && table->old_tuplestore == NULL)
- table->old_tuplestore = tuplestore_begin_heap(false, false, work_mem);
- if (need_new && table->new_tuplestore == NULL)
- table->new_tuplestore = tuplestore_begin_heap(false, false, work_mem);
- }
- PG_CATCH();
- {
- CurrentResourceOwner = saveResourceOwner;
- PG_RE_THROW();
- }
- PG_END_TRY();
+ CurrentResourceOwner = CurTransactionResourceOwner;
+
+ if (need_old && table->old_tuplestore == NULL)
+ table->old_tuplestore = tuplestore_begin_heap(false, false, work_mem);
+ if (need_new && table->new_tuplestore == NULL)
+ table->new_tuplestore = tuplestore_begin_heap(false, false, work_mem);
+
CurrentResourceOwner = saveResourceOwner;
MemoryContextSwitchTo(oldcxt);