Skip to content

dbBindArrow() rejects every stream with named columns #642

Done

Description

@krlmlr

dbBindArrow() fails with "params must not be named." for any stream whose columns have names, which includes every stream made from a data frame or an Arrow table. Only streams with empty column names can be bound, and those are what DBItest's arrow_bind_* specs use, so the specs pass.

Location: RPostgres dbBind() rejects named parameters, which is intended for dbBind() (see #266), and the DBI default param_stream_to_list() keeps the column names unless all of them are empty.

Reprex against the CRAN release (the output on main at 41cd4be is the same):

Sys.setenv(PGHOST = "localhost", PGPORT = "5432", PGUSER = "runner", PGPASSWORD = "test123", PGDATABASE = "testdb")
library(DBI)
con <- dbConnect(RPostgres::Postgres())
rs <- dbSendQueryArrow(con, "SELECT $1::int AS a")
dbBindArrow(rs, nanoarrow::as_nanoarrow_array_stream(data.frame(a = 1:2)))
#> Error:
#> ! `params` must not be named.
# Expected: two rows, a = 1, 2
dbClearResult(rs)

# Works only with empty names
rs <- dbSendQueryArrow(con, "SELECT $1::int AS a")
dbBindArrow(rs, nanoarrow::as_nanoarrow_array_stream(setNames(data.frame(1:2), "")))
as.data.frame(dbFetchArrow(rs))
#>   a
#> 1 1
#> 2 2
dbClearResult(rs)

dbGetQuery(con, "SHOW server_version")
#>                          server_version
#> 1 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1)
dbDisconnect(con)
as.data.frame(sessioninfo::package_info(c("RPostgres", "DBI", "nanoarrow"), dependencies = FALSE))[c("package", "ondiskversion", "source")]
#>             package ondiskversion         source
#> DBI             DBI         1.3.0           RSPM
#> nanoarrow nanoarrow         0.9.0           RSPM
#> RPostgres RPostgres        1.4.10 RSPM (R 4.5.0)

Created on 2026-11-29 with reprex v2.1.1

  • decide: match stream columns to $1, $2, ... by position and ignore names, or keep the error
  • fix
  • test (with named columns, which DBItest does not cover)

Severity: medium (proposed, Kirill may change). The common case errors.

Native Arrow support is coordinated in #631; it is expected to fix this by construction only if the native bind matches columns by position and ignores names, which is a decision for the bind work. dbBind() with named lists keeps its existing behavior either way.

Activity

  1. added a commit that references this issue on Nov 29, 2026
    c19ffc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions