MCPcopy Create free account
hub / github.com/apache/cloudberry / PLy_abort_open_subtransactions

Function PLy_abort_open_subtransactions

src/pl/plpython/plpy_exec.c:1112–1135  ·  view source on GitHub ↗

* Abort lingering subtransactions that have been explicitly started * by plpy.subtransaction().start() and not properly closed. */

Source from the content-addressed store, hash-verified

1110 * by plpy.subtransaction().start() and not properly closed.
1111 */
1112static void
1113PLy_abort_open_subtransactions(int save_subxact_level)
1114{
1115 Assert(save_subxact_level >= 0);
1116
1117 while (list_length(explicit_subtransactions) > save_subxact_level)
1118 {
1119 PLySubtransactionData *subtransactiondata;
1120
1121 Assert(explicit_subtransactions != NIL);
1122
1123 ereport(WARNING,
1124 (errmsg("forcibly aborting a subtransaction that has not been exited")));
1125
1126 RollbackAndReleaseCurrentSubTransaction();
1127
1128 subtransactiondata = (PLySubtransactionData *) linitial(explicit_subtransactions);
1129 explicit_subtransactions = list_delete_first(explicit_subtransactions);
1130
1131 MemoryContextSwitchTo(subtransactiondata->oldcontext);
1132 CurrentResourceOwner = subtransactiondata->oldowner;
1133 pfree(subtransactiondata);
1134 }
1135}

Callers 1

PLy_procedure_callFunction · 0.85

Calls 6

list_lengthFunction · 0.85
list_delete_firstFunction · 0.85
MemoryContextSwitchToFunction · 0.85
errmsgFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected