Writing struct or data frame columns fails with a confusing COPY error
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 77/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- postgresql, r
- Área
- backend-api-design, database
Línea de trabajo
Empieza por dbDataType() en R/dbDataType_PqConnection.R y la codificación de listas en sql_data_copy() en R/tables.R; el issue describe ambas rutas que fallan. Revisa las pruebas existentes para dbWriteTable() y dbWriteTableArrow() y añade cobertura para columnas de tipo struct y data frame. La tarea estará completa cuando ambas rutas rechacen estas columnas con un error claro que indique que no son compatibles.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Writing an Arrow struct column with dbWriteTableArrow(), or a data frame column with dbWriteTable(), creates a column typed after the inner column (integer here) and then fails in COPY with "invalid input syntax for type integer", which does not say what is wrong.
Location: RPostgres, dbDataType() on a data frame returns the types of its columns, so a nested data frame column gets its inner column's type; the encoding then treats the column as a list (sql_data_copy()).
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())
tbl <- arrow::arrow_table(x = arrow::Array$create(data.frame(a = 1:2)))
dbWriteTableArrow(con, "t_struct", tbl, overwrite = TRUE)
#> Error:
#> ! COPY returned error : ERROR: invalid input syntax for type integer: "\x12"
#> CONTEXT: COPY t_struct, line 1, column x: "\x12"
# Expected: an error that says struct columns are not supported
dbRemoveTable(con, "t_struct", fail_if_missing = FALSE)
# Same with a data frame column
df <- data.frame(id = 1:2)
df$x <- data.frame(a = 1:2)
dbWriteTable(con, "t_struct", df, overwrite = TRUE)
#> Error:
#> ! COPY returned error : ERROR: invalid input syntax for type integer: "\x12"
#> CONTEXT: COPY t_struct, line 1, column x: "\x12"
dbRemoveTable(con, "t_struct", fail_if_missing = FALSE)
#> NOTICE: table "t_struct" does not exist, skipping
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", "arrow"), dependencies = FALSE))[c("package", "ondiskversion", "source")]
#> package ondiskversion source
#> arrow arrow 26.0.1.1 RSPM
#> 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
- fix (a clear error for struct and data frame columns)
- test
Severity: low (proposed, Kirill may change). It fails loudly, only the message is unclear.
Native Arrow support is coordinated in https://github.com/r-dbi/RPostgres/pull/631; it is not expected to fix this by construction. The native create should reject struct columns with a clear message, and the data frame path stays as it is.
- Lenguaje dominante
- R
- Estrellas
- 345
- Forks
- 81
- Merge medio
- 8 h 21 min
- PR fusionados (30 d)
- 18
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de r-dbi/RPostgres
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dates and timestamps outside years 0001 to 9999, and `infinity`, are read as garbage, with a probable out-of-bounds readPosiblemente ocupada @krlmlr la tomó hoy. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
performance
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de r-dbi/RPostgres
Issues similares
-
Installation fails from source: missing libintl.h on macOS, undeclared R_typeToChar() on R 4.6Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vincentarelbundock/xtx#11 ·
-
Check that backends override both `dbFetchArrowChunk()` and `dbClearArrowChunk()`, or neitherAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
priority:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
ichirio/rtfreporter#1166 ·
Los mantenedores suelen responder en 1 día