Message-ID: <de8c7cb40811061559w42ab6f72vc90ad5e6690d60df@mail.gmail.com>
Date: 2008-11-06T23:59:33Z
From: Prasenjit Kapat
Subject: errors using the field.types arg in dbBuildTableDefinition() for RPostgreSQL
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