Skip to content

fix: dbBind() binds a list whose names are all empty by position - #927

Draft
krlmlr wants to merge 3 commits into
claude/fix-877-negative-utc-offsetfrom
claude/rb-bind-empty-names
Draft

krlmlr wants to merge 3 commits into
claude/fix-877-negative-utc-offsetfrom
claude/rb-bind-empty-names

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 30, 2026

Copy link
Copy Markdown
Member

For anonymous (?) or numbered (?1) placeholders, dbBind() now binds a list whose names are all empty, such as setNames(list(1), ""), by position, as it binds an unnamed list. Before, it failed with "Cannot use named parameters for anonymous/numbered placeholders", because the check in R/db_bind.R was !is.null(names(params)) || any(names(params) != ""), which is true for any list with a names attribute. The check is now any(nzchar(names(params))): the intended &&, written so that an NA name still counts as a name and gives the same error instead of "missing value where TRUE/FALSE needed". A list with at least one nonempty name, fully or partially named, is refused as before; named placeholders are unaffected.

Tested in tests/testthat/test-dbBind.R: an all-empty-named list binds to ? and to ?2, ?1 placeholders (both fail on the base with the error above, pass with the fix), and a fully named, partially named, or NA-named list is still refused (passes on both). Full suite with NOT_CRAN=true: 0 failures, 10563 passed, 63 skipped, 6 warnings; the three errors in test-httpvfs.R come from the local HTTP server in the sandbox and occur identically on the base.

Layer B0 of the rebuilt chain, planned in #880; based on #885. Not ported from an old PR; the bug was noticed while rebuilding the chain.

Coordinating session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4



Generated by Claude Code

For anonymous or numbered placeholders,
`db_bind()` refused any list with a names attribute,
because the check joined `!is.null(names(params))` and `any(names(params) != "")` with `||`.
A list whose names are all `""` now binds as an unnamed list.
A list with at least one nonempty or `NA` name is still refused with the same error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
@krlmlr
krlmlr force-pushed the claude/rb-bind-empty-names branch from 7c5f40c to 0231eb2 Compare November 30, 2026 23:43
@krlmlr
krlmlr added this pull request to stack #928 November 30, 2026 23:44

This branch has not been deployed

No deployments
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.

2 participants