tests/testthat/test-data-type.R

# Taken from DBI
test_that("dbDataType works on a data frame", {
  con <- postgresDefault()
  on.exit(dbDisconnect(con))

  df <- data.frame(x = 1:10, y = 1:10 / 2)
  types <- dbDataType(con, df)

  expect_equal(types, c(x = "INTEGER", y = "DOUBLE PRECISION"))
})
rstats-db/RPostgres documentation built on April 20, 2024, 11:55 a.m.