You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux jupiter 6.13.5-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb 27 15:07:31 UTC 2025 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Please run this code:
import{DatabaseSync}from"node:sqlite";constdb=newDatabaseSync(":memory:");db.exec(`CREATE TABLE people ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, birthdate TEXT NOT NULL) STRICT`);constinsertPeople=db.prepare(`INSERT INTO people (name, birthdate)VALUES (:name, :birthdate)RETURNING id`);constid1=insertPeople.run({name: "Flash",birthdate: "1956-07-16"});constid2=insertPeople.run({name: "Bruno",birthdate: "1962-12-11"});constid3=insertPeople.run({name: "Bruce",birthdate: "1963-06-17"});console.log("id1",id1);console.log("id2",id2);console.log("id3",id3);
How often does it reproduce? Is there a required condition?
If RETURNING id is set in the query, the changes field is affected
What is the expected behavior? Why is that the expected behavior?
Version
v23.9.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Please run this code:
How often does it reproduce? Is there a required condition?
If
RETURNING id
is set in the query, the changes field is affectedWhat is the expected behavior? Why is that the expected behavior?
id1 { lastInsertRowid: 1, changes: 1 }
id2 { lastInsertRowid: 2, changes: 1 }
id3 { lastInsertRowid: 3, changes: 1 }
What do you see instead?
id1 { lastInsertRowid: 1, changes: 0 }
id2 { lastInsertRowid: 2, changes: 1 }
id3 { lastInsertRowid: 3, changes: 1 }
In id1, the changes field should be
1
Additional information
Using
better-sqlite3
correctly handles it:Outputs:
id1 { changes: 1, lastInsertRowid: 1 }
id2 { changes: 1, lastInsertRowid: 2 }
id3 { changes: 1, lastInsertRowid: 3 }
The text was updated successfully, but these errors were encountered: