Skip to content

Commit

Permalink
restore spi internal xact mode to previous
Browse files Browse the repository at this point in the history
Signed-off-by: Tanzeel Khan <[email protected]>
  • Loading branch information
tanscorpio7 committed Dec 26, 2023
1 parent f2b07e3 commit a57ed14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion contrib/babelfishpg_tsql/src/iterative_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,13 +1306,16 @@ dispatch_stmt_handle_error(PLtsql_execstate *estate,
{
if (is_part_of_pltsql_trycatch_block(estate))
{
bool spi_current_internal_xact_mode;

HOLD_INTERRUPTS();
elog(DEBUG1, "TSQL TXN PG semantics : Rollback current transaction");
HoldPinnedPortals();
SPI_getCurrentInternalTxnMode(&spi_current_internal_xact_mode);
SPI_setCurrentInternalTxnMode(true);
AbortCurrentTransaction();
StartTransactionCommand();
SPI_setCurrentInternalTxnMode(false);
SPI_setCurrentInternalTxnMode(spi_current_internal_xact_mode);
MemoryContextSwitchTo(cur_ctxt);
RESUME_INTERRUPTS();
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/src/pl_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4252,7 +4252,7 @@ pltsql_call_handler(PG_FUNCTION_ARGS)
PLtsql_execstate *save_cur_estate;
Datum retval;
int rc;
int save_nestlevel;
int save_nestlevel = PltsqlGUCNestLevel;
int scope_level;
MemoryContext savedPortalCxt;
bool support_tsql_trans = pltsql_support_tsql_transactions();
Expand Down

0 comments on commit a57ed14

Please sign in to comment.