Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ca7efa8

Browse files
Deepesh125Commitfest Bot
authored and
Commitfest Bot
committed
Allow parallelism for plpgsql return expression after commit 556f7b7
With the commit 556f7b7, we unintentionally blocked parallelism to evaluate plpgsql return expression because maxtuples = 2 is being passed to exec_run_select(...) from exec_eval_expr(...) to evaluate the return expression of the plpgsql function. Idea to fix this issue to pass maxtuples = 0. It is safe to do it because number of processed rows is anyway being checked later in exec_eval_expr(...). But with this, there is not real caller remained which calls exec_run_select(...) with maxtuple != 0 so updated definition of exec_run_select(...) to remove maxtuples argument. Signed-off-by: Dipesh Dhameliya <dipeshdhameliya125@gmail.com>
1 parent a1de1b0 commit ca7efa8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/pl/plpgsql/src/pl_exec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static Datum exec_eval_expr(PLpgSQL_execstate *estate,
385385
Oid *rettype,
386386
int32 *rettypmod);
387387
static int exec_run_select(PLpgSQL_execstate *estate,
388-
PLpgSQL_expr *expr, long maxtuples, Portal *portalP);
388+
PLpgSQL_expr *expr, Portal *portalP);
389389
static int exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
390390
Portal portal, bool prefetch_ok);
391391
static ParamListInfo setup_param_list(PLpgSQL_execstate *estate,
@@ -2181,7 +2181,7 @@ exec_stmt_perform(PLpgSQL_execstate *estate, PLpgSQL_stmt_perform *stmt)
21812181
{
21822182
PLpgSQL_expr *expr = stmt->expr;
21832183

2184-
(void) exec_run_select(estate, expr, 0, NULL);
2184+
(void) exec_run_select(estate, expr, NULL);
21852185
exec_set_found(estate, (estate->eval_processed != 0));
21862186
exec_eval_cleanup(estate);
21872187

@@ -2844,7 +2844,7 @@ exec_stmt_fors(PLpgSQL_execstate *estate, PLpgSQL_stmt_fors *stmt)
28442844
/*
28452845
* Open the implicit cursor for the statement using exec_run_select
28462846
*/
2847-
exec_run_select(estate, stmt->query, 0, &portal);
2847+
exec_run_select(estate, stmt->query, &portal);
28482848

28492849
/*
28502850
* Execute the loop
@@ -5703,7 +5703,7 @@ exec_eval_expr(PLpgSQL_execstate *estate,
57035703
/*
57045704
* Else do it the hard way via exec_run_select
57055705
*/
5706-
rc = exec_run_select(estate, expr, 2, NULL);
5706+
rc = exec_run_select(estate, expr, NULL);
57075707
if (rc != SPI_OK_SELECT)
57085708
ereport(ERROR,
57095709
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
@@ -5761,7 +5761,7 @@ exec_eval_expr(PLpgSQL_execstate *estate,
57615761
*/
57625762
static int
57635763
exec_run_select(PLpgSQL_execstate *estate,
5764-
PLpgSQL_expr *expr, long maxtuples, Portal *portalP)
5764+
PLpgSQL_expr *expr, Portal *portalP)
57655765
{
57665766
ParamListInfo paramLI;
57675767
int rc;
@@ -5810,7 +5810,7 @@ exec_run_select(PLpgSQL_execstate *estate,
58105810
* Execute the query
58115811
*/
58125812
rc = SPI_execute_plan_with_paramlist(expr->plan, paramLI,
5813-
estate->readonly_func, maxtuples);
5813+
estate->readonly_func, 0);
58145814
if (rc != SPI_OK_SELECT)
58155815
{
58165816
/*

0 commit comments

Comments
 (0)