Skip to content

Commit eb4ed5f

Browse files
author
hackorum
committed
Apply plpgsql_stored_procedures.patch
1 parent 4255812 commit eb4ed5f

3 files changed

Lines changed: 426 additions & 0 deletions

File tree

‎src/pl/plpgsql/src/pl_exec.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5996,6 +5996,17 @@ exec_run_select(PLpgSQL_execstate *estate,
59965996
}
59975997

59985998

5999+
static bool
6000+
contains_transaction_control_stmt(PLpgSQL_stmt *stmt, void* ctx)
6001+
{
6002+
if (stmt->cmd_type == PLPGSQL_STMT_COMMIT || stmt->cmd_type == PLPGSQL_STMT_ROLLBACK)
6003+
{
6004+
*(bool*)ctx = false;
6005+
return false;
6006+
}
6007+
return true;
6008+
}
6009+
59996010
/*
60006011
* exec_for_query --- execute body of FOR loop for each row from a portal
60016012
*
@@ -6022,6 +6033,9 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
60226033
*/
60236034
PinPortal(portal);
60246035

6036+
if (prefetch_ok)
6037+
plpgsql_stmts_walker(stmt->body, contains_transaction_control_stmt, NULL, &prefetch_ok);
6038+
60256039
/*
60266040
* In a non-atomic context, we dare not prefetch, even if it would
60276041
* otherwise be safe. Aside from any semantic hazards that that might

0 commit comments

Comments
 (0)