if self._execmany_returning is None:
# Received from execute()
- # TODO: bug we also end up here on executemany() if run from inside
- # a pipeline block. This causes a wrong rowcount. As it isn't so
- # serious, currently leaving it this way.
self._results.extend(results)
if first_batch:
self._set_current_result(0)
[(10,), (20,)],
returning=True,
)
+ assert cur.rowcount == 2
assert cur.fetchone() == (1,)
assert cur.nextset()
assert cur.fetchone() == (2,)
assert cur.nextset() is None
-@pytest.mark.xfail
-def test_executemany_rowcount(conn):
- conn.autocommit = True
- conn.execute(
- "create temp table test_executemany_rowcount ("
- " id serial primary key, num integer)"
- )
- with conn.pipeline(), conn.cursor() as cur:
- cur.executemany(
- "insert into test_executemany_rowcount (num) values (%s) returning id",
- [(10,), (20,)],
- )
-
- # TODO: failing. It is caused by reentering the pipeline mode in
- # executemany(). Leaving it here to monitor how it changes. The snag is
- # in Cursor._set_results_from_pipeline()
- assert cur.rowcount == 2
-
-
def test_prepared(conn):
conn.autocommit = True
with conn.pipeline():
[(10,), (20,)],
returning=True,
)
+ assert cur.rowcount == 2
assert (await cur.fetchone()) == (1,)
assert cur.nextset()
assert (await cur.fetchone()) == (2,)