Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/plpython/plpython.c')
-rw-r--r--src/pl/plpython/plpython.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index c25db9344f6..6f31501c7a8 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1164,6 +1164,14 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure *proc)
Py_XDECREF(plargs);
Py_XDECREF(plrv);
+ /*
+ * If there was an error the iterator might have not been exhausted
+ * yet. Set it to NULL so the next invocation of the function will
+ * start the iteration again.
+ */
+ Py_XDECREF(proc->setof);
+ proc->setof = NULL;
+
PG_RE_THROW();
}
PG_END_TRY();