From b7212c9726ee4bdf0ddd938742f03e86d8c431bf Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 23 Nov 2013 09:34:57 -0500 Subject: [PATCH] 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. --- src/backend/utils/adt/ruleutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index dffac7c529..29a1027a10 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -480,7 +480,7 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags) */ args[0] = ObjectIdGetDatum(ruleoid); nulls[0] = ' '; - spirc = SPI_execute_plan(plan_getrulebyoid, args, nulls, true, 1); + spirc = SPI_execute_plan(plan_getrulebyoid, args, nulls, true, 0); if (spirc != SPI_OK_SELECT) elog(ERROR, "failed to get pg_rewrite tuple for rule %u", ruleoid); if (SPI_processed != 1) @@ -635,7 +635,7 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn) args[1] = DirectFunctionCall1(namein, CStringGetDatum(ViewSelectRuleName)); nulls[0] = ' '; nulls[1] = ' '; - spirc = SPI_execute_plan(plan_getviewrule, args, nulls, true, 2); + spirc = SPI_execute_plan(plan_getviewrule, args, nulls, true, 0); if (spirc != SPI_OK_SELECT) elog(ERROR, "failed to get pg_rewrite tuple for view %u", viewoid); if (SPI_processed != 1)