/usr/lib/R/site-library/RPostgreSQL/devTests/timeTypeComparison.r is in r-cran-rpostgresql 0.4-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/usr/bin/R
suppressMessages({
library(RODBC)
library(RPostgreSQL)
})
testTimeData <- function(tt = "date") {
createTempTable(tt)
channel <- odbcConnect("beancounter")
odbcres <- sqlQuery(channel, "select * from timetest")
close(channel)
con <- dbConnect( dbDriver("PostgreSQL"), dbname="beancounter")
pgres <- dbGetQuery(con, "select * from timetest")
dbDisconnect(con)
removeTempTable()
cat("\nFor type='", tt, "'\nODBC returns ", format(odbcres[1,1]), " class ", class(odbcres[1,1]),
"\nRPostgreSQL returns ", format(pgres[1,1]), " class ", class(pgres[1,1]), "\n", sep="")
}
createTempTable <- function(tt) {
system(paste("psql beancounter -c \"create table timetest ( d1", tt, ")\" >/dev/null"))
system("psql beancounter -c \"insert into timetest values( \'now\' )\" >/dev/null")
}
removeTempTable <- function() {
system("psql beancounter -c \"drop table timetest\" >/dev/null")
}
testTimeData("date")
testTimeData("timestamp with time zone")
testTimeData("timestamp without time zone")
testTimeData("time with time zone")
testTimeData("time without time zone")
|