[R-sig-DB] errors using the field.types arg in dbBuildTableDefinition() for RPostgreSQL

Prasenjit Kapat k@p@tp @end|ng |rom gm@||@com
Fri Nov 7 00:59:33 CET 2008


Well, here is the problem:
> (mydata2 <- data.frame(x=1:3, y=4:6))

>   dbBuildTableDefinition(con, "tmp_vidtable", mydata2, field.types=c("smallint", "smallint"), row.names = FALSE)

>   dbBuildTableDefinition(con, "tmp_vidtable", mydata2, field.types = c("integer", "integer"), row.names = FALSE)

>   dbBuildTableDefinition(con, "tmp_vidtable", mydata2, field.types = "", row.names = FALSE)

>   dbBuildTableDefinition(con, "tmp_vidtable", mydata2, field.types = NULL, row.names = FALSE)

All the above calls to dbBuildTableDefinition give the following error:

Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function "make.db.names", for
signature "PostgreSQLConnection", "NULL"

But this works, albeit forcing the bigint type:

>   dbBuildTableDefinition(con, "tmp_vidtable", mydata2, row.names = FALSE)
[1] "CREATE TABLE tmp_vidtable \n( x bigint,\n\ty bigint \n)"
                                                       ^             ^^
OK, this is a petty issue: the above SQL statement is not "indented"
correctly :)

Getting back, ?dbBuildTableDefinition shows the following:

field.types   optional named list of the types for each field in obj

Am I interpreting it wrongly?

Thanks.
--
PK




More information about the R-sig-DB mailing list