Skip to content

fix: dbBind() accepts parameters whose names are all empty - #607

Merged
krlmlr merged 1 commit into
mainfrom
claude/bind-empty-names
Nov 29, 2026
Merged

krlmlr merged 1 commit into
mainfrom
claude/bind-empty-names

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member

Closes #599.

Before this change, dbBind() rejected any parameter list with non-NULL names, so setNames(list(1), "") failed with "Cannot use named parameters for anonymous placeholders". It now rejects a list only if some name is neither empty nor NA. That matches DBI's specification ("names … must not be empty or NA") and DBItest's bind_named_param_empty_placeholders and bind_named_param_na_placeholders, which treat both cases alike. A list with a real name still gets the old error.

The same check exists in RSQLite; it was reported on r-dbi/RSQLite#866.

Tests

tests/testthat/test-dbBind.R (new) has two standalone tests: one binds names c("", NA) and checks the fetched values, and one checks that a real name still errors. Local run against MariaDB 10.11 with NOT_CRAN=true: DBItest passed 8568 checks with 0 failures. The whole suite had one failure, the test-timezone.R "US/Alaska" error, which also happens on main in this container. MySQL was not tested: there is no server in this container, and CI's MySQL entries currently run MariaDB (#592).

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


Generated by Claude Code

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Accepted limitations

The clean review found nothing above Low. No limitation is introduced by this PR.


Generated by Claude Code

@krlmlr
krlmlr marked this pull request as ready for review November 29, 2026 12:01
@krlmlr
krlmlr merged commit d2b524f into main Nov 29, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/bind-empty-names branch November 29, 2026 13:59
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.

dbBind() rejects parameters whose names are all empty

2 participants