CRAN Package Check Results for Package RPostgreSQL

Last updated on 2022-01-19 10:55:35 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.7-3 OK
r-devel-linux-x86_64-debian-gcc 0.7-3 7.10 43.36 50.46 OK
r-devel-linux-x86_64-fedora-clang 0.7-3 79.05 OK
r-devel-linux-x86_64-fedora-gcc 0.7-3 67.64 OK
r-devel-windows-x86_64-new-UL 0.7-3 230.00 87.00 317.00 OK
r-devel-windows-x86_64-new-TK 0.7-3 OK
r-patched-linux-x86_64 0.7-3 10.31 52.69 63.00 OK
r-release-linux-x86_64 0.7-3 OK
r-release-macos-arm64 0.7-3 OK
r-release-macos-x86_64 0.7-3 OK
r-release-windows-ix86+x86_64 0.7-3 141.00 203.00 344.00 ERROR
r-oldrel-macos-x86_64 0.7-3 OK
r-oldrel-windows-ix86+x86_64 0.7-3 144.00 202.00 346.00 ERROR

Check Details

Version: 0.7-3
Check: running tests for arch ‘i386’
Result: ERROR
     Running 'connectWithNull.R' [3s]
     Running 'createTableMixedCaseTest.R' [3s]
     Running 'dataTypeTests.R' [3s]
     Running 'dateTZ.R' [3s]
     Running 'datetimeTests.R' [3s]
     Running 'datetimestampwrite.R' [3s]
     Running 'dbColumnInfo.R' [3s]
     Running 'dbExistsIssue.R' [3s]
     Running 'dbExistsq.R' [3s]
     Running 'dbExistsqc.R' [3s]
     Running 'dbGetQueryParams.R' [3s]
     Running 'dbListFields.R' [3s]
     Running 'dbTransactionTests.R' [3s]
     Running 'dbWriteTableSchema.R' [3s]
     Running 'dbWriteTableTest.R' [3s]
     Running 'dbWriteTabletypes.R' [3s]
     Running 'dbtemptable.R' [3s]
     Running 'escape.R' [3s]
     Running 'loadDriverAndConnect.R' [3s]
     Running 'openSendQuery.R' [3s]
     Running 'selectWithAlias.R' [3s]
     Running 'utf.R' [3s]
    Running the tests in 'tests/connectWithNull.R' failed.
    Complete output:
     >
     > ## connectWithNull test
     > ##
     > ## test for the 'Issue 2' on the Google Code issue log
     > ## reported in April 2009, still open ?
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db -- replacing any of these with NULL will lead to
     + ## a stop() call and a return to the R prompt rather than a segfault
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + ## do we get here?
     + print(con)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/createTableMixedCaseTest.R' failed.
    Complete output:
     >
     > ## createTableMixedCaseTest test
     > ##
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Neil Tiffin, 30 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=Sys.getenv("POSTGRES_PORT"))
     +
     +
     +
     + res <- dbGetQuery(con, "create table Foo1 (f1 int)")
     + res <- dbGetQuery(con, "create table \"Foo2\" (f1 int)")
     +
     + cat("Test should create foo1 and Foo2 tables\n")
     + ## res <- dbGetQuery(con, "SELECT * FROM information_schema.tables WHERE table_schema = 'public'")
     + ## print res
     +
     + if (dbExistsTable(con, "Foo1")) {
     + cat("FAIL - Foo1 Table exists.\n")
     + }
     + else {
     + cat("Pass - Foo1 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "foo1")) {
     + cat("Pass - foo1 Table exists.\n")
     + }
     + else {
     + cat("FAIL - foo1 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "Foo2")) {
     + cat("Pass - Foo2 Table exists.\n")
     + }
     + else {
     + cat("FAIL - Foo2 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "foo2")) {
     + cat("FAIL - foo2 Table exists.\n")
     + }
     + else {
     + cat("Pass - foo2 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "\"Foo2\"")) {
     + cat("FAIL - \"Foo2\" Table exists.\n")
     + }
     + else {
     + cat("Pass - \"Foo2\" Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "\"foo2\"")) {
     + cat("FAIL - \"foo2\" Table exists.\n")
     + }
     + else {
     + cat("Pass - \"foo2\" Table does not exist.\n")
     + }
     +
     + res <- dbGetQuery(con, "drop table Foo1")
     + res <- dbGetQuery(con, "drop table \"Foo2\"")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (W)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dataTypeTests.R' failed.
    Complete output:
     > ## Test of data types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn integer, floatcolumn float);")
     +
     + i <- as.integer(10)
     + j <- as.numeric(56.6)
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql)
     +
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + cat("Read Numeric values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "integer" )
     + stopifnot( class(dat[,2]) == "numeric" )
     + cat("GOOD -- all numeric types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all numeric values are as expected\n")
     +
     + ## Test the logical mapping
     + if (dbExistsTable(con, "testlogical"))
     + dbRemoveTable(con, "testlogical")
     + dbGetQuery(con,"create table testlogical (col1 boolean, col2 boolean)")
     +
     + i <- as.logical(TRUE)
     + j <- as.logical(FALSE)
     +
     + sql <- paste("insert into testlogical ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testlogical")
     + dbRemoveTable(con, "testlogical")
     + cat("Read Logical values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "logical" )
     + stopifnot( class(dat[,2]) == "logical" )
     + cat("GOOD -- all logical types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all logical values are as expected\n")
     +
     + ## Test the character mapping
     + if (dbExistsTable(con, "testchar"))
     + dbRemoveTable(con, "testchar")
     + dbGetQuery(con,"create table testchar (code char(3),city varchar(20),country text);")
     +
     + i <- as.character("IN")
     + j <- as.character("Hyderabad")
     + k <- as.character("India")
     +
     + sql <- paste("insert into testchar ",
     + "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testchar")
     + cat("Read Character values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "character" )
     + stopifnot( class(dat[,2]) == "character" )
     + stopifnot( class(dat[,3]) == "character" )
     + cat("GOOD -- all character types are as expected\n")
     +
     + ## and test the values
     + ##stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + stopifnot( identical( dat[1,3], k))
     + cat("GOOD -- all character values are as expected\n")
     +
     + dbRemoveTable(con, "testchar")
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dateTZ.R' failed.
    Complete output:
     >
     > ## Test of date and datetime types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > dbTypeTests <- function(con, dateclass="timestamp without time zone", tz="UTC") {
     + cat("\n\n**** Trying with ", dateclass, "\n")
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbGetQuery(con, paste("create table tempostgrestable (tt ", dateclass, ", zz integer);", sep=""))
     + insstring <- '2008-07-01 14:15:16.123+00'
     + cat(paste('inserted string 1:', insstring))
     + cat("\n")
     + dbGetQuery(con, paste("insert into tempostgrestable values('", insstring, "', 1);", sep=""))
     +
     + # now <- ISOdatetime(2000,1,2,3,4,5.678)
     + insstring <- '2000-01-02 03:04:05.678+00'
     + cat(paste('inserted string 2:', insstring))
     + cat("\n")
     + dbGetQuery(con, paste("insert into tempostgrestable values('", insstring, "', 2);", sep=""))
     + tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02 13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
     + print(tt)
     +
     + dbGetQuery(con, paste("SET TIMEZONE TO '", tz, "'", sep=""))
     +
     + data <- dbGetQuery(con, "select tt from tempostgrestable;")
     +
     + times <- data[,1]
     + print(times)
     + if(as.double(tt[1]) == as.double(times[1])){
     + cat('PASS\n')
     + }else{
     + cat('FAIL\n')
     + }
     + if(as.double(tt[2]) == as.double(times[2])){
     + cat('PASS\n')
     + }else{
     + cat('FAIL\n')
     + }
     +
     +
     + dbRemoveTable(con, "tempostgrestable")
     + invisible(NULL)
     + }
     >
     > ## only run this if this env.var is set correctly
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## Force a timezone to make the tests comparable at different locations
     + Sys.setenv("TZ"="UTC")
     + tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02 13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
     + print(tt)
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + cat('testing UTC')
     + dbTypeTests(con, "timestamp")
     + dbTypeTests(con, "timestamp with time zone")
     + cat('testing Asia/Tokyo')
     + dbTypeTests(con, "timestamp", tz="Asia/Tokyo")
     + dbTypeTests(con, "timestamp with time zone", tz="Asia/Tokyo")
     + cat('testing Australlia/South')
     + dbTypeTests(con, "timestamp", tz="Australia/South")
     + dbTypeTests(con, "timestamp with time zone", tz="Australia/South")
     + cat('testing America/New_York')
     + dbTypeTests(con, "timestamp", tz="America/New_York")
     + dbTypeTests(con, "timestamp with time zone", tz="America/New_York")
     +
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     [1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/datetimeTests.R' failed.
    Complete output:
     >
     > ## Test of date and datetime types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > dbTypeTests <- function(con, dateclass="timestamp without time zone") {
     + cat("\n\n**** Trying with ", dateclass, "\n")
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbGetQuery(con, paste("create table tempostgrestable (tt ", dateclass, ", zz integer);", sep=""))
     + dbGetQuery(con, "insert into tempostgrestable values('2008-07-01 14:15:16.123', 1);")
     +
     + now <- ISOdatetime(2000,1,2,3,4,5.678)
     + dbGetQuery(con, paste("insert into tempostgrestable values('", format(now), "', 2);", sep=""))
     +
     + res <- dbReadTable(con, "tempostgrestable")
     + print(res)
     +
     + res <- dbSendQuery(con, "select tt from tempostgrestable;")
     + data <- fetch(res, n=-1)
     + print(dbColumnInfo(res))
     +
     + times <- data[,1]
     + print(times)
     + print(class(times[1]))
     +
     + print(diff(times))
     +
     + dbRemoveTable(con, "tempostgrestable")
     + invisible(NULL)
     + }
     >
     > ## only run this if this env.var is set correctly
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## Force a timezone to make the tests comparable at different locations
     + Sys.setenv("PGDATESTYLE"="German")
     + Sys.setenv("TZ"="UTC")
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + dbTypeTests(con, "timestamp")
     + # dbTypeTests(con, "timestamp with time zone")
     + # output differs depending on the compute environment
     + dbTypeTests(con, "date")
     +
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/datetimestampwrite.R' failed.
    Complete output:
     > ## Test of data types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn date, floatcolumn timestamp with time zone);")
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values ('2011-03-07', '2011-03-07 16:30:39') ")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + cat("Read Date and TIMESTAMP values\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat[1,1]))
     + cat("\n")
     + }
     + if( class(dat[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat[1,2]))
     + cat("\n")
     + }
     +
     + dbWriteTable(con, "tempostgrestable2", dat)
     + dat2 <- dbReadTable(con, "tempostgrestable2")
     + dbRemoveTable(con, "tempostgrestable2")
     + cat("Check that read after write gets the same data types\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat2[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat2[1,1]))
     + cat("\n")
     + }
     + if( class(dat2[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat2[1,2]))
     + cat("\n")
     + }
     +
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbColumnInfo.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + # create a table
     + res <- dbGetQuery(con, "CREATE TABLE aa (pk integer, v1 float not null, v2 float)" )
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "INSERT INTO aa VALUES(3, 2, NULL)" )
     + res <- dbSendQuery(con, "select pk, v1, v2, v1+v2 from aa")
     + cat("dbColumnInfo\n")
     + print(dbColumnInfo(res))
     + print(dbColumnInfo(res))
     + cat("SELECT result\n")
     + df <- fetch(res, n=-1)
     + print(df)
     +
     + ## cleanup
     + cat("Removing \"AA\"\n")
     + dbRemoveTable(con, "aa")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbExistsIssue.R' failed.
    Complete output:
     >
     > ## dbExists test with schema name: reported as Issue 3 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=3
     > ## and based on an earlier email by Prasenjit Kapat
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple dbExists
     + cat("Does rockdata exist? ")
     + print(res <- dbExistsTable(con, "rockdata"))
     +
     + ## this should return TRUE but did not -- does now after patch
     + cat("Does public.rockdata exist? ")
     + print(res <- dbExistsTable(con, "public.rockdata"))
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbExistsq.R' failed.
    Complete output:
     >
     > ## dbExists test with schema name: reported as Issue 3 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=3
     > ## and based on an earlier email by Prasenjit Kapat
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rock'data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock'data")
     + }
     +
     + cat("Write rock'data\n")
     + dbWriteTable(con, "rock'data", rock)
     +
     + ## run a simple dbExists
     + cat("Does rock'data exist? ")
     + print(res <- dbExistsTable(con, "rock'data"))
     +
     + ## this should return TRUE but did not -- does now after patch
     + cat("Does \"public.rock'data\" exist? ")
     + print(res <- dbExistsTable(con, "public.rock'data"))
     +
     + ## cleanup
     + if (dbExistsTable(con, "rock'data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock'data")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbExistsqc.R' failed.
    Complete output:
     >
     > ## dbExistsq test with schema name: reported as Issue 28 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=28
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rock.data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock.data")
     + }
     +
     +
     + dbWriteTable(con, "rock.data", rock)
     + ## run a simple dbExists
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("PASS: true\n")
     + }else{
     + cat("FAIL: false\n")
     + }
     +
     + ##
     + cat("create schema testschema and change the search_path\n")
     +
     + dbGetQuery(con, 'CREATE SCHEMA testschema')
     + dbGetQuery(con, 'SET search_path TO testschema')
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("FAIL: true despite search_path change\n")
     + }else{
     + cat("PASS: false as the search_path changed\n")
     + }
     +
     + cat("Does testschema.\"rock.data\" exist? \n")
     + res <- dbExistsTable(con, c('testschema', "rock.data"))
     + if(res){
     + cat("FAIL: true despite testschema specified\n")
     + }else{
     + cat("PASS: false as the testschema specified\n")
     + }
     +
     + cat("Does public.\"rock.data\" exist? \n")
     + res <- dbExistsTable(con, c('public', "rock.data"))
     + if(res){
     + cat("PASS: true despite search_path change\n")
     + }else{
     + cat("FAIL: false as the search_path changed\n")
     + }
     +
     +
     + cat("write in current schema\n")
     + dbWriteTable(con, "rock.data", rock)
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("PASS: true\n")
     + }else{
     + cat("FAIL: false\n")
     + }
     +
     + ## cleanup
     + dbGetQuery(con, 'DROP TABLE "public"."rock.data"')
     + dbGetQuery(con, 'DROP TABLE "testschema"."rock.data"')
     + dbGetQuery(con, 'DROP schema "testschema"')
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbGetQueryParams.R' failed.
    Complete output:
     > ## dbGetQuery test with optional parameters
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 LIMIT 10", 4000)
     + print(res)
     + res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 AND shape < $2 LIMIT $3", c(4000, 0.2, 10))
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbListFields.R' failed.
    Complete output:
     > ## dbListFields test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + # create a table
     + res <- dbGetQuery(con, "CREATE SCHEMA testschema")
     + res <- dbGetQuery(con, "CREATE TABLE testschema.aa (pid integer, name text)")
     + res <- dbGetQuery(con, "CREATE TABLE aa (pk integer, v1 float not null, v2 float)" )
     +
     + ## run a simple query and show the query result
     + df <- dbListFields(con, "aa")
     + print(df)
     + if (length(df) == 3){
     + cat("PASS: 3 fields returned\n")
     + }else{
     + cat(paste("FAIL:", length(df), "fields returned\n"))
     + }
     +
     + df <- dbListFields(con, c("testschema", "aa"))
     + print(df)
     + if (length(df) == 2){
     + cat("PASS: 2 fields returned\n")
     + }else{
     + cat(paste("FAIL:", length(df), "fields returned\n"))
     + }
     +
     +
     + ## cleanup
     + cat("Removing \"AA\"\n")
     + dbRemoveTable(con, "aa")
     + dbGetQuery(con, "DROP TABLE testschema.aa")
     + dbGetQuery(con, "DROP SCHEMA testschema")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbTransactionTests.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## create two independent connections
     + con1 <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + con2 <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("Removing rockdata\n")
     + dbRemoveTable(con1, "rockdata")
     + }
     +
     + cat("begin transaction in con1\n")
     + dbGetQuery(con1, "BEGIN TRANSACTION")
     + cat("create table rockdata in con1\n")
     + dbWriteTable(con1, "rockdata", rock)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("PASS rockdata is visible through con1\n")
     + }else{
     + cat("FAIL rockdata is invisible through con1\n")
     + }
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("FAIL rockdata is visible through con2\n")
     + }else{
     + cat("PASS rockdata is invisible through con2\n")
     + }
     + cat("commit in con1\n")
     + dbCommit(con1)
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("PASS rockdata is visible through con2\n")
     + }else{
     + cat("FAIL rockdata is invisible through con2\n")
     + }
     +
     + cat("remove the table from con1\n")
     + dbRemoveTable(con1, "rockdata")
     +
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("FAIL rockdata is visible through con2\n")
     + }else{
     + cat("PASS rockdata is invisible through con2\n")
     + }
     +
     + cat("begin transaction in con1\n")
     + dbGetQuery(con1, "BEGIN TRANSACTION")
     + cat("create table rockdata in con1\n")
     + dbWriteTable(con1, "rockdata", rock)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("PASS rockdata is visible through con1\n")
     + }else{
     + cat("FAIL rockdata is invisible through con1\n")
     + }
     + cat("RollBack con1\n")
     + dbRollback(con1)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("FAIL rockdata is visible through con1\n")
     + }else{
     + cat("PASS rockdata is invisible through con1\n")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con2)
     + dbDisconnect(con1)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbWriteTableSchema.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, c("public", "rockdata"))) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, c("public", "rockdata"))
     + }
     +
     + dbWriteTable(con, c("public", "rockdata"), rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from public.rockdata limit 10")
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, c("public", "rockdata"))) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, c("public", "rockdata"))
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbWriteTableTest.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from rockdata limit 10")
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbWriteTabletypes.R' failed.
    Complete output:
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbGetQuery(con, "set client_encoding to 'UTF-8'")
     + difficultstrings <- c("normal", "t\tab", "v\vertical tab", "n\newline", "r carriage \retern", "back \\ slash", "f\form feed")
     + df <- data.frame(strings=difficultstrings)
     +
     + dbWriteTable(con, "rockdata", df)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from rockdata")
     + print(res)
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     +
     + difficultstringe <- c("normal", "m\u00fc\u00df")
     + df <- data.frame(strings=difficultstringe)
     + tryres <- try({dbWriteTable(con, "rockdata", df)
     + res <- dbGetQuery(con, "select * from rockdata")
     + for(n in 1:2){
     + cat(paste(as.character(n), "\t"))
     + cat(res[n,2])
     + cat("\n")
     + }
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + })
     + if(tryres != TRUE){
     + cat("FAIL: could not write small umlaut u and ligature sz.\n")
     + cat(" This might be no problem for you if you don't use those special characters.\n")
     + cat(" Otherwise, please check for the server encoding.\n")
     + cat(" Database encoding is usually set at the time of createdb.\n")
     + cat(" You can see for more information on how to setup at \n")
     + cat(" http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
     + }else{
     + cat("PASS: could write small umlaut u and ligature sz\n")
     + }
     +
     + difficultstringk <- c("normal", "kanji\u6f22\u5b57")
     + df <- data.frame(strings=difficultstringk)
     + tryres <- try({dbWriteTable(con, "rockdata", df)
     + res <- dbGetQuery(con, "select * from rockdata")
     + for(n in 1:2){
     + cat(paste(as.character(n), "\t"))
     + cat(res[n,2])
     + cat("\n")
     + }
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + })
     + if(tryres != TRUE){
     + cat("FAIL: could not write kanji.\n")
     + cat(" This might be no problem for you if you don't use multibyte characters.\n")
     + cat(" Otherwise, please check for the server encoding.\n")
     + cat(" Database encoding is usually set at the time of createdb.\n")
     + cat(" You can see for more information on how to setup at \n")
     + cat(" http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
     + }else{
     + cat("PASS: could write kanji\n")
     + }
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn integer, floatcolumn float);")
     +
     + i <- as.integer(10)
     + j <- as.numeric(56.6)
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + res <- dbWriteTable(con, "numerictable", dat)
     + dat <- dbReadTable(con, "numerictable")
     + dbRemoveTable(con, "numerictable")
     + cat("Read Numeric values\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat[,1]) == "integer" ) {
     + cat("PASS -- all integer is as expected\n")
     + }else{
     + cat(paste("FAIL -- an integer became ", class(dat[,1]), "\n"))
     + }
     + stopifnot( class(dat[,2]) == "numeric" )
     +
     + ## and test the values
     + if( identical( dat[1,1], i)){
     + cat("PASS integer value is preserved")
     + }else{
     + cat(paste("FAIL:", i, "changed to", dat[1,1], "\n"))
     + }
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all numeric values are as expected\n")
     +
     + ## Test the logical mapping
     + if (dbExistsTable(con, "testlogical"))
     + dbRemoveTable(con, "testlogical")
     + dbGetQuery(con,"create table testlogical (col1 boolean, col2 boolean)")
     +
     + i <- as.logical(TRUE)
     + j <- as.logical(FALSE)
     +
     + sql <- paste("insert into testlogical ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testlogical")
     + res <- dbWriteTable(con, "logicaltable", dat)
     + dbRemoveTable(con, "testlogical")
     + dat2 <- dbReadTable(con,"logicaltable")
     + dbRemoveTable(con, "logicaltable")
     + cat("Read Logical values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat2[,1]) == "logical" )
     + stopifnot( class(dat2[,2]) == "logical" )
     + cat("GOOD -- all logical types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat2[1,1], i))
     + stopifnot( identical( dat2[1,2], j))
     + cat("GOOD -- all logical values are as expected\n")
     +
     + ## Test the character mapping
     + if (dbExistsTable(con, "testchar"))
     + dbRemoveTable(con, "testchar")
     + dbGetQuery(con,"create table testchar (code char(3),city varchar(20),country text);")
     +
     + i <- as.character("IN")
     + j <- as.character("Hyderabad")
     + k <- as.character("India")
     +
     + sql <- paste("insert into testchar ",
     + "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testchar")
     + dbRemoveTable(con, "testchar")
     + dbWriteTable(con, "testchar", dat)
     + dat <- dbReadTable(con, "testchar")
     + cat("Read Character values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "character" )
     + stopifnot( class(dat[,2]) == "character" )
     + stopifnot( class(dat[,3]) == "character" )
     + cat("GOOD -- all character types are as expected\n")
     +
     + ## and test the values
     + ##stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + stopifnot( identical( dat[1,3], k))
     + cat("GOOD -- all character values are as expected\n")
     +
     + dbRemoveTable(con, "testchar")
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn date, floatcolumn timestamp with time zone);")
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values ('2011-03-07', '2011-03-07 16:30:39') ")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + dbWriteTable(con, "tempostgrestable2", dat)
     + dat2 <- dbReadTable(con, "tempostgrestable2")
     + dbRemoveTable(con, "tempostgrestable2")
     + cat("Check that read after write gets the same data types\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat2[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat2[1,1]))
     + cat("\n")
     + }
     + if( class(dat2[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat2[1,2]))
     + cat("\n")
     + }
     +
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/dbtemptable.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     +
     + a <- dbGetQuery(con, "CREATE TABLE foo (name text)")
     + b <- dbGetQuery(con, "INSERT INTO foo VALUES ('bar')")
     +
     + ## run a simple query and show the query result
     + x <- dbSendQuery(con, "CREATE TEMPORARY TABLE xyz ON COMMIT DROP AS select * from foo limit 1; select * from xyz;")
     + res <- fetch(x, n=-1)
     + print(res)
     + a <- dbGetQuery(con, "DROP TABLE foo")
     +
     +
     + ## cleanup
     +
     + ## and disconnect
     + dbDisconnect(con)
     + cat("PASS -- ended without segmentation fault\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/escape.R' failed.
    Complete output:
     >
     > ## connectWithNull test
     > ##
     > ## test for the 'Issue 2' on the Google Code issue log
     > ## reported in April 2009, still open ?
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db -- replacing any of these with NULL will lead to
     + ## a stop() call and a return to the R prompt rather than a segfault
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + st <- (postgresqlEscapeStrings(con,"aaa"))
     + print(st)
     + st2 <- (postgresqlEscapeStrings(con,"aa'a"))
     + print(st2)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/loadDriverAndConnect.R' failed.
    Complete output:
     >
     > ## First rough version of a test script
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 02 Jul 2008
     > ## 21 Oct 2008 make conditional on environment variables
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, paste("select datname,encoding,datallowconn from pg_database",
     + "where datname like 'template%' order by datname"))
     + print(res)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/openSendQuery.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## create two independent connections
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tmptest")) {
     + cat("Removing tmptest\n")
     + dbRemoveTable(con, "tmptest")
     + }
     + # create temporary table (as a copy of any existing one)
     + # dbGetQuery(con, "BEGIN TRANSACTION")
     + cat("create temp table tmptest with dbGetQuery\n")
     + dbGetQuery(con, "CREATE TEMP TABLE tmptest (f1 int)")
     +
     + # query temp table
     + rs<-dbGetQuery(con, "SELECT * from tmptest")
     + print(rs)
     +
     + cat("create temp table tmptest with dbSendQuery\n")
     + dbSendQuery(con, "CREATE TEMP TABLE tmptest2(f2 int)")
     +
     + # query temp table
     + rs2<-dbGetQuery(con, "SELECT * from tmptest2")
     + print(rs2)
     + ## and disconnect
     + dbDisconnect(con)
     +
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tmptest")) {
     + cat("FAIL tmptest persisted after disconnection\n")
     + cat("Removing tmptest\n")
     + dbRemoveTable(con, "tmptest")
     + }else{
     + cat("PASS tmptest disappeared after disconnection\n")
     + }
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/selectWithAlias.R' failed.
    Complete output:
     >
     > ## selectWithAlias test
     > ##
     > ## test for the 'Issue 1' on the Google Code issue log
     > ## this was reported in June and fixed by Joe Conway (svr committ r100)
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select area as ar, peri as pe, shape as sh, perm as pr from rockdata limit 10")
     + print(res)
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
    Running the tests in 'tests/utf.R' failed.
    Complete output:
     > ## Test of bytea conversion with insert and retrieve to the db.
     > ##
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "texttable"))
     + dbRemoveTable(con, "texttable")
     +
     + x_df <- data.frame(x = c("a", "ö", "æ¼¢å­<c2><97>"), stringsAsFactors = FALSE)
     +
     + dbGetQuery(con, "SHOW server_encoding")
     + dbGetQuery(con, "SET client_encoding = 'UTF8'")
     + dbGetQuery(con, "SHOW client_encoding")
     + # write with client_encoding = 'UTF8' and read back what was wrote
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "UTF-8" )
     + stopifnot( e[3] == "UTF-8" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + x_df <- data.frame(x = c("a", "ö"), stringsAsFactors = FALSE)
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + dbGetQuery(con, "SET client_encoding = 'LATIN1'")
     + dbGetQuery(con, "SHOW client_encoding")
     + # read with client_encoding = 'LATIN1' what was already in the database
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "latin1" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + # write with client_encoding = 'LATIN1' and read back what was wrote
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "latin1" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + dbRemoveTable(con, "texttable")
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     + cat("DONE\n")
     + }else{
     + cat("Skip because envirinmental variables are not set to tell the connection params.\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (R)
     Calls: dbConnect -> dbConnect -> postgresqlNewConnection
     Execution halted
Flavors: r-release-windows-ix86+x86_64, r-oldrel-windows-ix86+x86_64

Version: 0.7-3
Check: running tests for arch ‘x64’
Result: ERROR
     Running 'connectWithNull.R' [3s]
     Running 'createTableMixedCaseTest.R' [3s]
     Running 'dataTypeTests.R' [3s]
     Running 'dateTZ.R' [3s]
     Running 'datetimeTests.R' [3s]
     Running 'datetimestampwrite.R' [3s]
     Running 'dbColumnInfo.R' [3s]
     Running 'dbExistsIssue.R' [3s]
     Running 'dbExistsq.R' [3s]
     Running 'dbExistsqc.R' [3s]
     Running 'dbGetQueryParams.R' [3s]
     Running 'dbListFields.R' [3s]
     Running 'dbTransactionTests.R' [3s]
     Running 'dbWriteTableSchema.R' [3s]
     Running 'dbWriteTableTest.R' [3s]
     Running 'dbWriteTabletypes.R' [3s]
     Running 'dbtemptable.R' [3s]
     Running 'escape.R' [3s]
     Running 'loadDriverAndConnect.R' [3s]
     Running 'openSendQuery.R' [3s]
     Running 'selectWithAlias.R' [3s]
     Running 'utf.R' [3s]
    Running the tests in 'tests/connectWithNull.R' failed.
    Complete output:
     >
     > ## connectWithNull test
     > ##
     > ## test for the 'Issue 2' on the Google Code issue log
     > ## reported in April 2009, still open ?
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db -- replacing any of these with NULL will lead to
     + ## a stop() call and a return to the R prompt rather than a segfault
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + ## do we get here?
     + print(con)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/createTableMixedCaseTest.R' failed.
    Complete output:
     >
     > ## createTableMixedCaseTest test
     > ##
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Neil Tiffin, 30 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=Sys.getenv("POSTGRES_PORT"))
     +
     +
     +
     + res <- dbGetQuery(con, "create table Foo1 (f1 int)")
     + res <- dbGetQuery(con, "create table \"Foo2\" (f1 int)")
     +
     + cat("Test should create foo1 and Foo2 tables\n")
     + ## res <- dbGetQuery(con, "SELECT * FROM information_schema.tables WHERE table_schema = 'public'")
     + ## print res
     +
     + if (dbExistsTable(con, "Foo1")) {
     + cat("FAIL - Foo1 Table exists.\n")
     + }
     + else {
     + cat("Pass - Foo1 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "foo1")) {
     + cat("Pass - foo1 Table exists.\n")
     + }
     + else {
     + cat("FAIL - foo1 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "Foo2")) {
     + cat("Pass - Foo2 Table exists.\n")
     + }
     + else {
     + cat("FAIL - Foo2 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "foo2")) {
     + cat("FAIL - foo2 Table exists.\n")
     + }
     + else {
     + cat("Pass - foo2 Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "\"Foo2\"")) {
     + cat("FAIL - \"Foo2\" Table exists.\n")
     + }
     + else {
     + cat("Pass - \"Foo2\" Table does not exist.\n")
     + }
     +
     + if (dbExistsTable(con, "\"foo2\"")) {
     + cat("FAIL - \"foo2\" Table exists.\n")
     + }
     + else {
     + cat("Pass - \"foo2\" Table does not exist.\n")
     + }
     +
     + res <- dbGetQuery(con, "drop table Foo1")
     + res <- dbGetQuery(con, "drop table \"Foo2\"")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dataTypeTests.R' failed.
    Complete output:
     > ## Test of data types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn integer, floatcolumn float);")
     +
     + i <- as.integer(10)
     + j <- as.numeric(56.6)
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql)
     +
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + cat("Read Numeric values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "integer" )
     + stopifnot( class(dat[,2]) == "numeric" )
     + cat("GOOD -- all numeric types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all numeric values are as expected\n")
     +
     + ## Test the logical mapping
     + if (dbExistsTable(con, "testlogical"))
     + dbRemoveTable(con, "testlogical")
     + dbGetQuery(con,"create table testlogical (col1 boolean, col2 boolean)")
     +
     + i <- as.logical(TRUE)
     + j <- as.logical(FALSE)
     +
     + sql <- paste("insert into testlogical ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testlogical")
     + dbRemoveTable(con, "testlogical")
     + cat("Read Logical values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "logical" )
     + stopifnot( class(dat[,2]) == "logical" )
     + cat("GOOD -- all logical types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all logical values are as expected\n")
     +
     + ## Test the character mapping
     + if (dbExistsTable(con, "testchar"))
     + dbRemoveTable(con, "testchar")
     + dbGetQuery(con,"create table testchar (code char(3),city varchar(20),country text);")
     +
     + i <- as.character("IN")
     + j <- as.character("Hyderabad")
     + k <- as.character("India")
     +
     + sql <- paste("insert into testchar ",
     + "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testchar")
     + cat("Read Character values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "character" )
     + stopifnot( class(dat[,2]) == "character" )
     + stopifnot( class(dat[,3]) == "character" )
     + cat("GOOD -- all character types are as expected\n")
     +
     + ## and test the values
     + ##stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + stopifnot( identical( dat[1,3], k))
     + cat("GOOD -- all character values are as expected\n")
     +
     + dbRemoveTable(con, "testchar")
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dateTZ.R' failed.
    Complete output:
     >
     > ## Test of date and datetime types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > dbTypeTests <- function(con, dateclass="timestamp without time zone", tz="UTC") {
     + cat("\n\n**** Trying with ", dateclass, "\n")
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbGetQuery(con, paste("create table tempostgrestable (tt ", dateclass, ", zz integer);", sep=""))
     + insstring <- '2008-07-01 14:15:16.123+00'
     + cat(paste('inserted string 1:', insstring))
     + cat("\n")
     + dbGetQuery(con, paste("insert into tempostgrestable values('", insstring, "', 1);", sep=""))
     +
     + # now <- ISOdatetime(2000,1,2,3,4,5.678)
     + insstring <- '2000-01-02 03:04:05.678+00'
     + cat(paste('inserted string 2:', insstring))
     + cat("\n")
     + dbGetQuery(con, paste("insert into tempostgrestable values('", insstring, "', 2);", sep=""))
     + tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02 13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
     + print(tt)
     +
     + dbGetQuery(con, paste("SET TIMEZONE TO '", tz, "'", sep=""))
     +
     + data <- dbGetQuery(con, "select tt from tempostgrestable;")
     +
     + times <- data[,1]
     + print(times)
     + if(as.double(tt[1]) == as.double(times[1])){
     + cat('PASS\n')
     + }else{
     + cat('FAIL\n')
     + }
     + if(as.double(tt[2]) == as.double(times[2])){
     + cat('PASS\n')
     + }else{
     + cat('FAIL\n')
     + }
     +
     +
     + dbRemoveTable(con, "tempostgrestable")
     + invisible(NULL)
     + }
     >
     > ## only run this if this env.var is set correctly
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## Force a timezone to make the tests comparable at different locations
     + Sys.setenv("TZ"="UTC")
     + tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02 13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
     + print(tt)
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + cat('testing UTC')
     + dbTypeTests(con, "timestamp")
     + dbTypeTests(con, "timestamp with time zone")
     + cat('testing Asia/Tokyo')
     + dbTypeTests(con, "timestamp", tz="Asia/Tokyo")
     + dbTypeTests(con, "timestamp with time zone", tz="Asia/Tokyo")
     + cat('testing Australlia/South')
     + dbTypeTests(con, "timestamp", tz="Australia/South")
     + dbTypeTests(con, "timestamp with time zone", tz="Australia/South")
     + cat('testing America/New_York')
     + dbTypeTests(con, "timestamp", tz="America/New_York")
     + dbTypeTests(con, "timestamp with time zone", tz="America/New_York")
     +
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
     [1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
    Running the tests in 'tests/datetimeTests.R' failed.
    Complete output:
     >
     > ## Test of date and datetime types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > dbTypeTests <- function(con, dateclass="timestamp without time zone") {
     + cat("\n\n**** Trying with ", dateclass, "\n")
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + dbGetQuery(con, paste("create table tempostgrestable (tt ", dateclass, ", zz integer);", sep=""))
     + dbGetQuery(con, "insert into tempostgrestable values('2008-07-01 14:15:16.123', 1);")
     +
     + now <- ISOdatetime(2000,1,2,3,4,5.678)
     + dbGetQuery(con, paste("insert into tempostgrestable values('", format(now), "', 2);", sep=""))
     +
     + res <- dbReadTable(con, "tempostgrestable")
     + print(res)
     +
     + res <- dbSendQuery(con, "select tt from tempostgrestable;")
     + data <- fetch(res, n=-1)
     + print(dbColumnInfo(res))
     +
     + times <- data[,1]
     + print(times)
     + print(class(times[1]))
     +
     + print(diff(times))
     +
     + dbRemoveTable(con, "tempostgrestable")
     + invisible(NULL)
     + }
     >
     > ## only run this if this env.var is set correctly
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## Force a timezone to make the tests comparable at different locations
     + Sys.setenv("PGDATESTYLE"="German")
     + Sys.setenv("TZ"="UTC")
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + dbTypeTests(con, "timestamp")
     + # dbTypeTests(con, "timestamp with time zone")
     + # output differs depending on the compute environment
     + dbTypeTests(con, "date")
     +
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/datetimestampwrite.R' failed.
    Complete output:
     > ## Test of data types, based on earlier version in inst/devTests
     > ##
     > ## Dirk Eddelbuettel, 21 Oct 2008
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn date, floatcolumn timestamp with time zone);")
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values ('2011-03-07', '2011-03-07 16:30:39') ")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + cat("Read Date and TIMESTAMP values\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat[1,1]))
     + cat("\n")
     + }
     + if( class(dat[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat[1,2]))
     + cat("\n")
     + }
     +
     + dbWriteTable(con, "tempostgrestable2", dat)
     + dat2 <- dbReadTable(con, "tempostgrestable2")
     + dbRemoveTable(con, "tempostgrestable2")
     + cat("Check that read after write gets the same data types\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat2[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat2[1,1]))
     + cat("\n")
     + }
     + if( class(dat2[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat2[1,2]))
     + cat("\n")
     + }
     +
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbColumnInfo.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + # create a table
     + res <- dbGetQuery(con, "CREATE TABLE aa (pk integer, v1 float not null, v2 float)" )
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "INSERT INTO aa VALUES(3, 2, NULL)" )
     + res <- dbSendQuery(con, "select pk, v1, v2, v1+v2 from aa")
     + cat("dbColumnInfo\n")
     + print(dbColumnInfo(res))
     + print(dbColumnInfo(res))
     + cat("SELECT result\n")
     + df <- fetch(res, n=-1)
     + print(df)
     +
     + ## cleanup
     + cat("Removing \"AA\"\n")
     + dbRemoveTable(con, "aa")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbExistsIssue.R' failed.
    Complete output:
     >
     > ## dbExists test with schema name: reported as Issue 3 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=3
     > ## and based on an earlier email by Prasenjit Kapat
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple dbExists
     + cat("Does rockdata exist? ")
     + print(res <- dbExistsTable(con, "rockdata"))
     +
     + ## this should return TRUE but did not -- does now after patch
     + cat("Does public.rockdata exist? ")
     + print(res <- dbExistsTable(con, "public.rockdata"))
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbExistsq.R' failed.
    Complete output:
     >
     > ## dbExists test with schema name: reported as Issue 3 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=3
     > ## and based on an earlier email by Prasenjit Kapat
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rock'data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock'data")
     + }
     +
     + cat("Write rock'data\n")
     + dbWriteTable(con, "rock'data", rock)
     +
     + ## run a simple dbExists
     + cat("Does rock'data exist? ")
     + print(res <- dbExistsTable(con, "rock'data"))
     +
     + ## this should return TRUE but did not -- does now after patch
     + cat("Does \"public.rock'data\" exist? ")
     + print(res <- dbExistsTable(con, "public.rock'data"))
     +
     + ## cleanup
     + if (dbExistsTable(con, "rock'data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock'data")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbExistsqc.R' failed.
    Complete output:
     >
     > ## dbExistsq test with schema name: reported as Issue 28 at
     > ## http://code.google.com/p/rpostgresql/issues/detail?id=28
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rock.data")) {
     + cat("Removing rock'data\n")
     + dbRemoveTable(con, "rock.data")
     + }
     +
     +
     + dbWriteTable(con, "rock.data", rock)
     + ## run a simple dbExists
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("PASS: true\n")
     + }else{
     + cat("FAIL: false\n")
     + }
     +
     + ##
     + cat("create schema testschema and change the search_path\n")
     +
     + dbGetQuery(con, 'CREATE SCHEMA testschema')
     + dbGetQuery(con, 'SET search_path TO testschema')
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("FAIL: true despite search_path change\n")
     + }else{
     + cat("PASS: false as the search_path changed\n")
     + }
     +
     + cat("Does testschema.\"rock.data\" exist? \n")
     + res <- dbExistsTable(con, c('testschema', "rock.data"))
     + if(res){
     + cat("FAIL: true despite testschema specified\n")
     + }else{
     + cat("PASS: false as the testschema specified\n")
     + }
     +
     + cat("Does public.\"rock.data\" exist? \n")
     + res <- dbExistsTable(con, c('public', "rock.data"))
     + if(res){
     + cat("PASS: true despite search_path change\n")
     + }else{
     + cat("FAIL: false as the search_path changed\n")
     + }
     +
     +
     + cat("write in current schema\n")
     + dbWriteTable(con, "rock.data", rock)
     + cat("Does rock.data exist? \n")
     + res <- dbExistsTable(con, "rock.data")
     + if(res){
     + cat("PASS: true\n")
     + }else{
     + cat("FAIL: false\n")
     + }
     +
     + ## cleanup
     + dbGetQuery(con, 'DROP TABLE "public"."rock.data"')
     + dbGetQuery(con, 'DROP TABLE "testschema"."rock.data"')
     + dbGetQuery(con, 'DROP schema "testschema"')
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbGetQueryParams.R' failed.
    Complete output:
     > ## dbGetQuery test with optional parameters
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 LIMIT 10", 4000)
     + print(res)
     + res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 AND shape < $2 LIMIT $3", c(4000, 0.2, 10))
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbListFields.R' failed.
    Complete output:
     > ## dbListFields test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + # create a table
     + res <- dbGetQuery(con, "CREATE SCHEMA testschema")
     + res <- dbGetQuery(con, "CREATE TABLE testschema.aa (pid integer, name text)")
     + res <- dbGetQuery(con, "CREATE TABLE aa (pk integer, v1 float not null, v2 float)" )
     +
     + ## run a simple query and show the query result
     + df <- dbListFields(con, "aa")
     + print(df)
     + if (length(df) == 3){
     + cat("PASS: 3 fields returned\n")
     + }else{
     + cat(paste("FAIL:", length(df), "fields returned\n"))
     + }
     +
     + df <- dbListFields(con, c("testschema", "aa"))
     + print(df)
     + if (length(df) == 2){
     + cat("PASS: 2 fields returned\n")
     + }else{
     + cat(paste("FAIL:", length(df), "fields returned\n"))
     + }
     +
     +
     + ## cleanup
     + cat("Removing \"AA\"\n")
     + dbRemoveTable(con, "aa")
     + dbGetQuery(con, "DROP TABLE testschema.aa")
     + dbGetQuery(con, "DROP SCHEMA testschema")
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbTransactionTests.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## create two independent connections
     + con1 <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + con2 <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("Removing rockdata\n")
     + dbRemoveTable(con1, "rockdata")
     + }
     +
     + cat("begin transaction in con1\n")
     + dbGetQuery(con1, "BEGIN TRANSACTION")
     + cat("create table rockdata in con1\n")
     + dbWriteTable(con1, "rockdata", rock)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("PASS rockdata is visible through con1\n")
     + }else{
     + cat("FAIL rockdata is invisible through con1\n")
     + }
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("FAIL rockdata is visible through con2\n")
     + }else{
     + cat("PASS rockdata is invisible through con2\n")
     + }
     + cat("commit in con1\n")
     + dbCommit(con1)
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("PASS rockdata is visible through con2\n")
     + }else{
     + cat("FAIL rockdata is invisible through con2\n")
     + }
     +
     + cat("remove the table from con1\n")
     + dbRemoveTable(con1, "rockdata")
     +
     + if (dbExistsTable(con2, "rockdata")) {
     + cat("FAIL rockdata is visible through con2\n")
     + }else{
     + cat("PASS rockdata is invisible through con2\n")
     + }
     +
     + cat("begin transaction in con1\n")
     + dbGetQuery(con1, "BEGIN TRANSACTION")
     + cat("create table rockdata in con1\n")
     + dbWriteTable(con1, "rockdata", rock)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("PASS rockdata is visible through con1\n")
     + }else{
     + cat("FAIL rockdata is invisible through con1\n")
     + }
     + cat("RollBack con1\n")
     + dbRollback(con1)
     + if (dbExistsTable(con1, "rockdata")) {
     + cat("FAIL rockdata is visible through con1\n")
     + }else{
     + cat("PASS rockdata is invisible through con1\n")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con2)
     + dbDisconnect(con1)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbWriteTableSchema.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, c("public", "rockdata"))) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, c("public", "rockdata"))
     + }
     +
     + dbWriteTable(con, c("public", "rockdata"), rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from public.rockdata limit 10")
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, c("public", "rockdata"))) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, c("public", "rockdata"))
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbWriteTableTest.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from rockdata limit 10")
     + print(res)
     +
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbWriteTabletypes.R' failed.
    Complete output:
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbGetQuery(con, "set client_encoding to 'UTF-8'")
     + difficultstrings <- c("normal", "t\tab", "v\vertical tab", "n\newline", "r carriage \retern", "back \\ slash", "f\form feed")
     + df <- data.frame(strings=difficultstrings)
     +
     + dbWriteTable(con, "rockdata", df)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select * from rockdata")
     + print(res)
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     +
     + difficultstringe <- c("normal", "m\u00fc\u00df")
     + df <- data.frame(strings=difficultstringe)
     + tryres <- try({dbWriteTable(con, "rockdata", df)
     + res <- dbGetQuery(con, "select * from rockdata")
     + for(n in 1:2){
     + cat(paste(as.character(n), "\t"))
     + cat(res[n,2])
     + cat("\n")
     + }
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + })
     + if(tryres != TRUE){
     + cat("FAIL: could not write small umlaut u and ligature sz.\n")
     + cat(" This might be no problem for you if you don't use those special characters.\n")
     + cat(" Otherwise, please check for the server encoding.\n")
     + cat(" Database encoding is usually set at the time of createdb.\n")
     + cat(" You can see for more information on how to setup at \n")
     + cat(" http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
     + }else{
     + cat("PASS: could write small umlaut u and ligature sz\n")
     + }
     +
     + difficultstringk <- c("normal", "kanji\u6f22\u5b57")
     + df <- data.frame(strings=difficultstringk)
     + tryres <- try({dbWriteTable(con, "rockdata", df)
     + res <- dbGetQuery(con, "select * from rockdata")
     + for(n in 1:2){
     + cat(paste(as.character(n), "\t"))
     + cat(res[n,2])
     + cat("\n")
     + }
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + })
     + if(tryres != TRUE){
     + cat("FAIL: could not write kanji.\n")
     + cat(" This might be no problem for you if you don't use multibyte characters.\n")
     + cat(" Otherwise, please check for the server encoding.\n")
     + cat(" Database encoding is usually set at the time of createdb.\n")
     + cat(" You can see for more information on how to setup at \n")
     + cat(" http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
     + }else{
     + cat("PASS: could write kanji\n")
     + }
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + if (dbExistsTable(con, "tempostgrestable"))
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn integer, floatcolumn float);")
     +
     + i <- as.integer(10)
     + j <- as.numeric(56.6)
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + res <- dbWriteTable(con, "numerictable", dat)
     + dat <- dbReadTable(con, "numerictable")
     + dbRemoveTable(con, "numerictable")
     + cat("Read Numeric values\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat[,1]) == "integer" ) {
     + cat("PASS -- all integer is as expected\n")
     + }else{
     + cat(paste("FAIL -- an integer became ", class(dat[,1]), "\n"))
     + }
     + stopifnot( class(dat[,2]) == "numeric" )
     +
     + ## and test the values
     + if( identical( dat[1,1], i)){
     + cat("PASS integer value is preserved")
     + }else{
     + cat(paste("FAIL:", i, "changed to", dat[1,1], "\n"))
     + }
     + stopifnot( identical( dat[1,2], j))
     + cat("GOOD -- all numeric values are as expected\n")
     +
     + ## Test the logical mapping
     + if (dbExistsTable(con, "testlogical"))
     + dbRemoveTable(con, "testlogical")
     + dbGetQuery(con,"create table testlogical (col1 boolean, col2 boolean)")
     +
     + i <- as.logical(TRUE)
     + j <- as.logical(FALSE)
     +
     + sql <- paste("insert into testlogical ",
     + "values (",i, "," ,j ,") ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testlogical")
     + res <- dbWriteTable(con, "logicaltable", dat)
     + dbRemoveTable(con, "testlogical")
     + dat2 <- dbReadTable(con,"logicaltable")
     + dbRemoveTable(con, "logicaltable")
     + cat("Read Logical values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat2[,1]) == "logical" )
     + stopifnot( class(dat2[,2]) == "logical" )
     + cat("GOOD -- all logical types are as expected\n")
     +
     + ## and test the values
     + stopifnot( identical( dat2[1,1], i))
     + stopifnot( identical( dat2[1,2], j))
     + cat("GOOD -- all logical values are as expected\n")
     +
     + ## Test the character mapping
     + if (dbExistsTable(con, "testchar"))
     + dbRemoveTable(con, "testchar")
     + dbGetQuery(con,"create table testchar (code char(3),city varchar(20),country text);")
     +
     + i <- as.character("IN")
     + j <- as.character("Hyderabad")
     + k <- as.character("India")
     +
     + sql <- paste("insert into testchar ",
     + "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
     + res <- dbGetQuery(con, sql);
     +
     + dat <- dbReadTable(con, "testchar")
     + dbRemoveTable(con, "testchar")
     + dbWriteTable(con, "testchar", dat)
     + dat <- dbReadTable(con, "testchar")
     + cat("Read Character values\n")
     +
     + ## now test the types of the colums we got
     + stopifnot( class(dat[,1]) == "character" )
     + stopifnot( class(dat[,2]) == "character" )
     + stopifnot( class(dat[,3]) == "character" )
     + cat("GOOD -- all character types are as expected\n")
     +
     + ## and test the values
     + ##stopifnot( identical( dat[1,1], i))
     + stopifnot( identical( dat[1,2], j))
     + stopifnot( identical( dat[1,3], k))
     + cat("GOOD -- all character values are as expected\n")
     +
     + dbRemoveTable(con, "testchar")
     + dbRemoveTable(con, "tempostgrestable")
     +
     + ## Test the numeric mapping
     + dbGetQuery(con, "create table tempostgrestable (intcolumn date, floatcolumn timestamp with time zone);")
     +
     + sql <- paste("insert into tempostgrestable ",
     + "values ('2011-03-07', '2011-03-07 16:30:39') ")
     + res <- dbGetQuery(con, sql)
     +
     + dat <- dbReadTable(con, "tempostgrestable")
     + dbRemoveTable(con, "tempostgrestable")
     + dbWriteTable(con, "tempostgrestable2", dat)
     + dat2 <- dbReadTable(con, "tempostgrestable2")
     + dbRemoveTable(con, "tempostgrestable2")
     + cat("Check that read after write gets the same data types\n")
     +
     + ## now test the types of the colums we got
     + if( class(dat2[1,1]) == "Date" ){
     + cat("PASS -- Date type is as expected\n")
     + }else{
     + cat("FAIL -- Date type is other than Date: ")
     + cat(class(dat2[1,1]))
     + cat("\n")
     + }
     + if( class(dat2[1,2])[1] == "POSIXct" ){
     + cat("PASS -- TIMESTAMP is received as POSIXct\n")
     + }else{
     + cat("FAIL -- TIMESTAMP is other than POSIXct: ")
     + cat(class(dat2[1,2]))
     + cat("\n")
     + }
     +
     +
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     +
     + cat("DONE\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/dbtemptable.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     +
     +
     + a <- dbGetQuery(con, "CREATE TABLE foo (name text)")
     + b <- dbGetQuery(con, "INSERT INTO foo VALUES ('bar')")
     +
     + ## run a simple query and show the query result
     + x <- dbSendQuery(con, "CREATE TEMPORARY TABLE xyz ON COMMIT DROP AS select * from foo limit 1; select * from xyz;")
     + res <- fetch(x, n=-1)
     + print(res)
     + a <- dbGetQuery(con, "DROP TABLE foo")
     +
     +
     + ## cleanup
     +
     + ## and disconnect
     + dbDisconnect(con)
     + cat("PASS -- ended without segmentation fault\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/escape.R' failed.
    Complete output:
     >
     > ## connectWithNull test
     > ##
     > ## test for the 'Issue 2' on the Google Code issue log
     > ## reported in April 2009, still open ?
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db -- replacing any of these with NULL will lead to
     + ## a stop() call and a return to the R prompt rather than a segfault
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + st <- (postgresqlEscapeStrings(con,"aaa"))
     + print(st)
     + st2 <- (postgresqlEscapeStrings(con,"aa'a"))
     + print(st2)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/loadDriverAndConnect.R' failed.
    Complete output:
     >
     > ## First rough version of a test script
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 02 Jul 2008
     > ## 21 Oct 2008 make conditional on environment variables
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     + ## can't print result as it contains process id which changes print(summary(drv))
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, paste("select datname,encoding,datallowconn from pg_database",
     + "where datname like 'template%' order by datname"))
     + print(res)
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/openSendQuery.R' failed.
    Complete output:
     >
     > ## dbWriteTable test
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 10 Sep 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## create two independent connections
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tmptest")) {
     + cat("Removing tmptest\n")
     + dbRemoveTable(con, "tmptest")
     + }
     + # create temporary table (as a copy of any existing one)
     + # dbGetQuery(con, "BEGIN TRANSACTION")
     + cat("create temp table tmptest with dbGetQuery\n")
     + dbGetQuery(con, "CREATE TEMP TABLE tmptest (f1 int)")
     +
     + # query temp table
     + rs<-dbGetQuery(con, "SELECT * from tmptest")
     + print(rs)
     +
     + cat("create temp table tmptest with dbSendQuery\n")
     + dbSendQuery(con, "CREATE TEMP TABLE tmptest2(f2 int)")
     +
     + # query temp table
     + rs2<-dbGetQuery(con, "SELECT * from tmptest2")
     + print(rs2)
     + ## and disconnect
     + dbDisconnect(con)
     +
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "tmptest")) {
     + cat("FAIL tmptest persisted after disconnection\n")
     + cat("Removing tmptest\n")
     + dbRemoveTable(con, "tmptest")
     + }else{
     + cat("PASS tmptest disappeared after disconnection\n")
     + }
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/selectWithAlias.R' failed.
    Complete output:
     >
     > ## selectWithAlias test
     > ##
     > ## test for the 'Issue 1' on the Google Code issue log
     > ## this was reported in June and fixed by Joe Conway (svr committ r100)
     > ##
     > ## Assumes that
     > ## a) PostgreSQL is running, and
     > ## b) the current user can connect
     > ## both of which are not viable for release but suitable while we test
     > ##
     > ## Dirk Eddelbuettel, 03 Oct 2009
     >
     > ## only run this if this env.var is set correctly
     > if (Sys.getenv("POSTGRES_USER") != "" & Sys.getenv("POSTGRES_HOST") != "" & Sys.getenv("POSTGRES_DATABASE") != "") {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     + stopifnot(require(datasets))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + dbWriteTable(con, "rockdata", rock)
     +
     + ## run a simple query and show the query result
     + res <- dbGetQuery(con, "select area as ar, peri as pe, shape as sh, perm as pr from rockdata limit 10")
     + print(res)
     +
     + ## cleanup
     + if (dbExistsTable(con, "rockdata")) {
     + print("Removing rockdata\n")
     + dbRemoveTable(con, "rockdata")
     + }
     +
     + ## and disconnect
     + dbDisconnect(con)
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
    Running the tests in 'tests/utf.R' failed.
    Complete output:
     > ## Test of bytea conversion with insert and retrieve to the db.
     > ##
     >
     > if ((Sys.getenv("POSTGRES_USER") != "") &
     + (Sys.getenv("POSTGRES_HOST") != "") &
     + (Sys.getenv("POSTGRES_DATABASE") != "")) {
     +
     + ## try to load our module and abort if this fails
     + stopifnot(require(RPostgreSQL))
     +
     + ## load the PostgresSQL driver
     + drv <- dbDriver("PostgreSQL")
     +
     + ## connect to the default db
     + con <- dbConnect(drv,
     + user=Sys.getenv("POSTGRES_USER"),
     + password=Sys.getenv("POSTGRES_PASSWD"),
     + host=Sys.getenv("POSTGRES_HOST"),
     + dbname=Sys.getenv("POSTGRES_DATABASE"),
     + port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p, 5432))
     +
     + if (dbExistsTable(con, "texttable"))
     + dbRemoveTable(con, "texttable")
     +
     + x_df <- data.frame(x = c("a", "ö", "æ¼¢å­<c2><97>"), stringsAsFactors = FALSE)
     +
     + dbGetQuery(con, "SHOW server_encoding")
     + dbGetQuery(con, "SET client_encoding = 'UTF8'")
     + dbGetQuery(con, "SHOW client_encoding")
     + # write with client_encoding = 'UTF8' and read back what was wrote
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "UTF-8" )
     + stopifnot( e[3] == "UTF-8" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + x_df <- data.frame(x = c("a", "ö"), stringsAsFactors = FALSE)
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + dbGetQuery(con, "SET client_encoding = 'LATIN1'")
     + dbGetQuery(con, "SHOW client_encoding")
     + # read with client_encoding = 'LATIN1' what was already in the database
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "latin1" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + # write with client_encoding = 'LATIN1' and read back what was wrote
     + dbWriteTable(con, "texttable", x_df, overwrite = TRUE)
     + (x_db <- dbReadTable(con, "texttable"))
     + (e <- Encoding(x_db$x))
     + stopifnot( e[1] == "unknown" )
     + stopifnot( e[2] == "latin1" )
     + cat("GOOD -- all encoding are as expected\n")
     +
     + dbRemoveTable(con, "texttable")
     + dbDisconnect(con)
     + dbUnloadDriver(drv)
     + cat("DONE\n")
     + }else{
     + cat("Skip because envirinmental variables are not set to tell the connection params.\n")
     + }
     Loading required package: RPostgreSQL
     Loading required package: DBI
Flavors: r-release-windows-ix86+x86_64, r-oldrel-windows-ix86+x86_64