`execute-batch!` using arguments from previous row if incomplete row provided
needs analysis
**Describe the bug**
If the user provides an incomplete row of arguments, next.jdbc re-uses values from previous rows.
**To Reproduce**
```clojure
(with-open [conn (jdbc/get-connection tu/*node*)
stmt (jdbc/prepare conn ["INSERT INTO users(_id, u_name) VALUES (?, ?)"])]
(jdbc/execute-batch! stmt [[1 "james"] [2]])
(t/is (= [{:_id 1, :u_name "james"}
{:_id 2, :u_name "james"}]
(jdbc/execute! conn ["SELECT users._id, users.u_name FROM users ORDER BY _id"]))))
```
**Expected behavior**
I'd expect the usual SQL "No value supplied for parameter 2" error.
Maybe solved by a call to `(.clearParameters stmt)` before each `.addBatch`?
**Environment (please complete the following information):**
- Database: XTDB (delegating to the Postgres driver)
- Driver Library Version: 2.0.0-beta8 (PGJDBC 42.7.5)
关闭于 2025-07-01 9 条评论