diff --git a/src/common/pl/plpgsql/src/pl_exec.cpp b/src/common/pl/plpgsql/src/pl_exec.cpp index 5c0696258215e696b4b206f4c7f984739d8228a0..effff0a8116324073df041bb4447f7d2007ca826 100644 --- a/src/common/pl/plpgsql/src/pl_exec.cpp +++ b/src/common/pl/plpgsql/src/pl_exec.cpp @@ -4049,7 +4049,7 @@ static int expand_stmts(PLpgSQL_execstate* estate, List* stmts, bool& exception_ return PLPGSQL_RC_OK; } - while(stmtid < num_stmts && !early_exit) { + while(stmtid < num_stmts && !early_exit && rc != PLPGSQL_RC_EXIT) { if (exception_flag) { if (rc == -1) rc = PLPGSQL_RC_EXIT;