]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: keep Cursor._execmany_returning set until reset
authorDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 29 Mar 2022 07:44:35 +0000 (09:44 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 2 Apr 2022 23:23:22 +0000 (01:23 +0200)
commit24de0afd052e5f4655e7fdb8a0b68bda8a974e20
tree2647e63a65e1b1dacf966331352cdb74d4120649
parentb9d1366a4428f88a84902ce6113c9c9eee719b09
fix: keep Cursor._execmany_returning set until reset

Cursor's _execmany_returning attribute is now initialized at _reset()
and set during _executemany_gen_pipeline(). This way, the attribute is
kept for further results fetch that may occur outside executemany()
context: namely, this is needed because _execmany_returning is used by
_set_results_from_pipeline() which would be called by fetch*() methods.

As a consequence, in _fetch_pipeline(), actual fetch is skipped when
coming from executemany(..., returning=False) as the pgresult would
never be set. This ensures a consistent behavior by raising "no result
available" when calling fetch*() from a non-returning executemany().
psycopg/psycopg/cursor.py
psycopg/psycopg/cursor_async.py
tests/test_pipeline.py
tests/test_pipeline_async.py