[R-sig-DB] RSQLite dbWriteTable: REAL() can only be applied to a 'numeric', not a 'logical'

Seth Falcon @eth @end|ng |rom u@erpr|m@ry@net
Thu Oct 25 16:04:41 CEST 2007


Hi all,

I've received to problem reports regarding dbWriteTable in RSQLite.
The issue can be reproduced by calling dbWriteTable on a data frame
where a logical column's first row contains logical NA:

      library(RSQLite)
      db = dbConnect(SQLite(), ":memory:")
      df = data.frame(a=1, b=as.logical(NA))
      dbWriteTable(db, "foo", df)
    Error in sqliteTransactionStatement(conn, "ROLLBACK") : 
      connection with pending rows, close resultSet before continuing
    In addition: Warning message:
    In value[[3]](cond) :
      REAL() can only be applied to a 'numeric', not a 'logical'

I'm working on a fix, but it may take me a few days.  In the meantime,
if you convert logical columns to integer, things should work:

      dbClearResult(dbListResults(db)[[1]])
      dbRollback(db)

      df$b = as.integer(df$b)
      dbWriteTable(db, "foo", df)

+ seth

-- 
Seth Falcon | seth using userprimary.net | blog: http://userprimary.net/user/




More information about the R-sig-DB mailing list