Title: node:sqlite returning statement affects changes field in run() · Issue #57344 · nodejs/node · GitHub
Open Graph Title: node:sqlite returning statement affects changes field in run() · Issue #57344 · nodejs/node
X Title: node:sqlite returning statement affects changes field in run() · Issue #57344 · nodejs/node
Description: Version v23.9.0 Platform 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 } fro...
Open Graph Description: Version v23.9.0 Platform 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 ru...
X Description: Version v23.9.0 Platform 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 ru...
Opengraph URL: https://github.com/nodejs/node/issues/57344
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"node:sqlite returning statement affects changes field in run()","articleBody":"### Version\n\nv23.9.0\n\n### Platform\n\n```text\nLinux jupiter 6.13.5-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb 27 15:07:31 UTC 2025 x86_64 GNU/Linux\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nPlease run this code:\n\n```js\nimport { DatabaseSync } from \"node:sqlite\";\nconst db = new DatabaseSync(\":memory:\");\n\ndb.exec(`CREATE TABLE people (\n id INTEGER PRIMARY KEY,\n name TEXT NOT NULL,\n birthdate TEXT NOT NULL\n) STRICT`);\n\nconst insertPeople = db.prepare(`\nINSERT INTO people\n (name, birthdate)\nVALUES\n (:name, :birthdate)\nRETURNING id\n`);\n\nconst id1 = insertPeople.run({ name: \"Flash\", birthdate: \"1956-07-16\" });\nconst id2 = insertPeople.run({ name: \"Bruno\", birthdate: \"1962-12-11\" });\nconst id3 = insertPeople.run({ name: \"Bruce\", birthdate: \"1963-06-17\" });\n\nconsole.log(\"id1\", id1);\nconsole.log(\"id2\", id2);\nconsole.log(\"id3\", id3);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIf `RETURNING id` is set in the query, the changes field is affected\n\n### What is the expected behavior? Why is that the expected behavior?\n\nid1 { lastInsertRowid: 1, changes: 1 }\nid2 { lastInsertRowid: 2, changes: 1 }\nid3 { lastInsertRowid: 3, changes: 1 }\n\n### What do you see instead?\n\nid1 { lastInsertRowid: 1, changes: 0 }\nid2 { lastInsertRowid: 2, changes: 1 }\nid3 { lastInsertRowid: 3, changes: 1 }\n\nIn id1, the changes field should be `1`\n\n### Additional information\n\nUsing `better-sqlite3` correctly handles it:\n\n```js\nimport Database from \"better-sqlite3\";\nconst db = new Database(\":memory:\");\n```\n\nOutputs:\n\nid1 { changes: 1, lastInsertRowid: 1 }\nid2 { changes: 1, lastInsertRowid: 2 }\nid3 { changes: 1, lastInsertRowid: 3 }","author":{"url":"https://github.com/sant123","@type":"Person","name":"sant123"},"datePublished":"2025-03-06T06:31:30Z","url":"https://github.com/nodejs/node/issues/57344"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:be9ddee1-eb8a-df37-6d8b-d5d810b1e363 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A64E:15C1B0:390958:4E0B9B:6B044F15 |
| html-safe-nonce | 3a0719688ac3eaddd44adb1c510f8c1d8b1cffa9854a4efae213fabb821b4829 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjRFOjE1QzFCMDozOTA5NTg6NEUwQjlCOjZCMDQ0RjE1IiwidmlzaXRvcl9pZCI6IjYwNDM3MTM1MzkzMTM3ODI1NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 43626e9e0077a7a981e472b693ca238711fd31ca9712bfff4748dbf2c64159f0 |
| hovercard-subject-tag | issue:2899483918 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/57344/issue_layout |
| twitter:image | https://opengraph.githubassets.com/389821a444c7a1157740db23d110388a1351091f59af24fa99841846bc950234/nodejs/node/issues/57344 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/389821a444c7a1157740db23d110388a1351091f59af24fa99841846bc950234/nodejs/node/issues/57344 |
| og:image:alt | Version v23.9.0 Platform 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 ru... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sant123 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 059f24c781e3a0d7df3f27a97da0e93fab06ae39 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width