Skip to content

fix: Bind a nanoarrow stream in params with dbBindArrow() - #662

Merged
krlmlr merged 2 commits into
claude/fix-bind-arrow-namesfrom
claude/fix-stream-params
Nov 29, 2026
Merged

krlmlr merged 2 commits into
claude/fix-bind-arrow-namesfrom
claude/fix-stream-params

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member

Closes #661.

dbGetQueryArrow() and dbSendQueryArrow() pass params unchanged to dbSendQuery(), which bound it with dbBind() and so rejected every nanoarrow stream. dbSendQuery() now binds a nanoarrow_array_stream with dbBindArrow() on the new result, which converts it to a list and executes once per row, and binds anything else with dbBind() as before.

dbSendQuery() also clears the new result when binding fails, so a failed call no longer leaves an open result set behind (and the next query no longer warns "Closing open result set"). This applies to the list path too, for example to named list parameters passed to dbGetQuery().

Since dbSendQuery() no longer passes a stream to dbBind(), the dedicated error from #658 now only fires for a direct dbBind(res, stream) call; its wording now names dbBind() and points to dbBindArrow(). The "must not be named" message is split into two sentences, as asked in the review of #658.

Tests cover dbGetQueryArrow(params = stream) with one and several rows, dbSendQueryArrow(params = stream) followed by dbFetchArrow(), a failing bind leaving no open result for both a stream and a list, and unchanged list parameters. The full devtools::test() passes locally against PostgreSQL 16, including the DBItest arrow specs.

This PR is stacked on #658. Native Arrow support (#631) would supersede the conversion through dbBindArrow().

Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g


Generated by Claude Code

`dbGetQueryArrow()` and `dbSendQueryArrow()` pass `params` unchanged to `dbSendQuery()`,
which bound it with `dbBind()` and rejected every stream (#661).
`dbSendQuery()` now binds a stream with `dbBindArrow()` and anything else with `dbBind()` as before.
It also clears the new result if binding fails, so no open result set is left behind.

The error for a stream passed to `dbBind()` now names `dbBind()` itself,
and the error for named parameters is split into two sentences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
@krlmlr
krlmlr added this pull request to stack #663 November 29, 2026 12:24
An error while evaluating the lazy `params` argument
left the result created by `dbSendQuery()` open,
because it happened before the cleanup was registered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
@krlmlr
krlmlr marked this pull request as ready for review November 29, 2026 12:27
@krlmlr krlmlr mentioned this pull request Nov 29, 2026
3 of 9 tasks
@krlmlr
krlmlr merged commit db82db1 into main Nov 29, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/fix-stream-params branch November 29, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dbGetQueryArrow() and dbSendQueryArrow() reject every Arrow stream passed as params

2 participants