-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
heya -
this started failing as of psycopg 3.0.6. passes with 3.0.5
import psycopg
conn = psycopg.connect(user="scott", password="tiger", dbname="test", host="pg13")
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE parent (
id SERIAL NOT NULL,
data INTEGER,
PRIMARY KEY (id)
)
""")
cursor.executemany("""INSERT INTO parent (id, data) VALUES (%(id)s::INTEGER, %(data)s::INTEGER)""",
({'id': 1, 'data': 2}, {'id': 2, 'data': 3})
)
cursor.execute("""DELETE from parent""")
assert cursor.rowcount == 2
cursor.executemany("""DELETE FROM parent WHERE parent.id = %(id)s::INTEGER""", ({'id': 1}, {'id': 2}))
assert cursor.rowcount == 0, f"{cursor.rowcount}"or more simply
import psycopg
conn = psycopg.connect(user="scott", password="tiger", dbname="test", host="pg13")
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE parent (
id SERIAL NOT NULL,
data INTEGER,
PRIMARY KEY (id)
)
""")
cursor.executemany("""DELETE FROM parent WHERE parent.id = %(id)s::INTEGER""", ({'id': 1}, {'id': 2}))
assert cursor.rowcount == 0, f"{cursor.rowcount}"also fails.
the cursor.rowcount is -1 when using version 3.0.6, it's 0 for previous versions. it seems to be related executemany() not matching any rows.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels