Close #179.
- Add `pq.PGconn.trace()` and related trace functions (:ticket:`#167`).
+Psycopg 3.0.7 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix crash in `~Cursor.executemany()` with no input sequence
+ (:ticket:`#179`).
+
+
Current release
---------------
for res in results:
nrows += res.command_tuples or 0
- self._set_result(0)
+ if self._results:
+ self._set_result(0)
+
# Override rowcout for the first result. Calls to nextset() will change
# it to the value of that result only, but we hope nobody will notice.
# You haven't read this comment.
assert cur.fetchall() == [(11, "hello"), (21, "world")]
+def test_executemany_no_data(conn, execmany):
+ cur = conn.cursor()
+ cur.executemany("insert into execmany(num, data) values (%s, %s)", [])
+ assert cur.rowcount == 0
+
+
def test_executemany_rowcount(conn, execmany):
cur = conn.cursor()
cur.executemany(
assert rv == [(11, "hello"), (21, "world")]
+async def test_executemany_no_data(aconn, execmany):
+ cur = aconn.cursor()
+ await cur.executemany(
+ "insert into execmany(num, data) values (%s, %s)", []
+ )
+ assert cur.rowcount == 0
+
+
async def test_executemany_rowcount(aconn, execmany):
cur = aconn.cursor()
await cur.executemany(