Repository navigation
Description
On read, dbGetQueryArrow() labels a timestamp (without time zone) column as timestamp[us, tz=UTC], the same as timestamptz. On write, dbWriteTableArrow() creates a timestamp with time zone column for a naive Arrow timestamp[us]. The naive/zoned distinction that both PostgreSQL and Arrow make is lost in both directions.
Location: RPostgres returns timestamp as POSIXct with a time zone (fix_timezone()), and the DBI default dbFetchArrowChunk() infers the Arrow type from it. On write, the DBI default dbCreateTableArrow() goes through an R ptype, and RPostgres maps every POSIXt to TIMESTAMPTZ.
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())
s <- dbGetQueryArrow(con, "SELECT '2020-01-01 12:00'::timestamp AS ts, '2020-01-01 12:00'::timestamptz AS tstz")
s$get_schema()$children$ts$format
#> [1] "tsu:UTC"
# Expected: "tsu:" (no time zone)
s$get_schema()$children$tstz$format
#> [1] "tsu:UTC"
tbl <- arrow::arrow_table(ts = arrow::Array$create(as.POSIXct("2020-01-01 12:00", tz = "UTC"), type = arrow::timestamp("us")))
tbl$schema
#> Schema
#> ts: timestamp[us]
dbWriteTableArrow(con, "t_ts", tbl, overwrite = TRUE)
dbGetQuery(con, "SELECT pg_typeof(ts)::text AS type FROM t_ts")
#> type
#> 1 timestamp with time zone
# Expected: timestamp without time zone
dbRemoveTable(con, "t_ts")
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 read (
timestamp→ naive,timestamptz→ UTC) - fix write (naive Arrow timestamp →
timestamp) - test
Severity: medium (proposed, Kirill may change).
Native Arrow support is coordinated in #631 and is expected to fix the read side by construction, since the type comes from the OID; the write side is fixed if the native create maps naive Arrow timestamps to timestamp.
Activity
krlmlr commentedon Nov 29, 2026
Closed to keep the issue tracker for issues reported by others; the work here is still open and tracked with the
status: openlabel.Generated by Claude Code