Skip to content

Commit b7212c9

Browse files
committed
Fix thinko in SPI_execute_plan() calls
Two call sites were apparently thinking that the last argument of SPI_execute_plan() is the number of query parameters, but it is actually the row limit. Change the calls to 0, since we don't care about the limit there. The previous code didn't break anything, but it was still wrong.
1 parent 4053189 commit b7212c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
480480
*/
481481
args[0] = ObjectIdGetDatum(ruleoid);
482482
nulls[0] = ' ';
483-
spirc = SPI_execute_plan(plan_getrulebyoid, args, nulls, true, 1);
483+
spirc = SPI_execute_plan(plan_getrulebyoid, args, nulls, true, 0);
484484
if (spirc != SPI_OK_SELECT)
485485
elog(ERROR, "failed to get pg_rewrite tuple for rule %u", ruleoid);
486486
if (SPI_processed != 1)
@@ -635,7 +635,7 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn)
635635
args[1] = DirectFunctionCall1(namein, CStringGetDatum(ViewSelectRuleName));
636636
nulls[0] = ' ';
637637
nulls[1] = ' ';
638-
spirc = SPI_execute_plan(plan_getviewrule, args, nulls, true, 2);
638+
spirc = SPI_execute_plan(plan_getviewrule, args, nulls, true, 0);
639639
if (spirc != SPI_OK_SELECT)
640640
elog(ERROR, "failed to get pg_rewrite tuple for view %u", viewoid);
641641
if (SPI_processed != 1)

0 commit comments

Comments
 (0)