Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88047e5

Browse files
committed
Fix an error when a set-returning function fails halfway through the execution
If the function using yield to return rows fails halfway, the iteratorstays open and subsequent calls to the function will resume readingfrom it. The fix is to unref the iterator and set it to NULL if therehas been an error.Jan Urbański
1 parent8995440 commit88047e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/pl/plpython/plpython.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,14 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure *proc)
11641164
Py_XDECREF(plargs);
11651165
Py_XDECREF(plrv);
11661166

1167+
/*
1168+
* If there was an error the iterator might have not been exhausted
1169+
* yet. Set it to NULL so the next invocation of the function will
1170+
* start the iteration again.
1171+
*/
1172+
Py_XDECREF(proc->setof);
1173+
proc->setof=NULL;
1174+
11671175
PG_RE_THROW();
11681176
}
11691177
PG_END_TRY();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp