mplourde / rpostgresql

Automatically exported from code.google.com/p/rpostgresql
0 stars 1 forks source link

dbConnect error - unable to find an inherited method for function "show", for signature "PostgreSQLConnection" #43

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to connect to a Postgresql 9.1.5 database. Usually the syntax below 
works, but for some reason I am getting a strange message now. I was wondering 
if this was a known issue. Thanks for your help. 

What steps will reproduce the problem?
1.drv = dbDriver('PostgreSQL')
2.con = dbConnect(drv, user = "user", password = "password", dbname = "dbname", 
host = "localhost", port = 5432)
3. con

Error in function (classes, fdef, mtable)  : 
  unable to find an inherited method for function "show", for signature "PostgreSQLConnection"

What is the expected output? What do you see instead?
Normally I would type "con" and it would tell me the drivername and reference a 
connection to the database.

What version of the product are you using? On what operating system?
ubuntu 11.10 64 bit, R 2.15.1, Postgresql 9.1.5, RPostgreSQL version--latest on 
CRAN.

Please provide any additional information below.

Original issue reported on code.google.com by uc.krish...@gmail.com on 24 Sep 2012 at 9:43

GoogleCodeExporter commented 9 years ago
I have the same error in the different use case. I believe my case is more 
clear and easy to reproduce.
I want to log API calls performed on market's API interface. Then I want to 
check the last API call time on particular market.

1.
Create empty table base on structure (I prefer to create this way as it fully 
reflects the data I'm going to store in that table):
dbWriteTable(conn = con, name = c('some_schema,'api_call'), value = 
data.table(market = character(), action = character(), api_call = 
as.POSIXct(NA,origin='1970-01-01',tz='GMT')[-1]), append = FALSE, row.names = 
FALSE)
It is working fine.

2.
Then I query the last API call on market - still I need to handle case when 
api_call table is empty:
dbGetQuery(conn = con, sql = "select api_call from some_schema.api_call where 
market = 'market_name' order by api_call desc limit 1")
I've got:
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"PostgreSQLConnection", "missing"’

I think the source of the issue might be in as.POSIXct(NULL,...) which I can 
handle in R by as.POSIXct(NA,...)[-1] as shown above, but such workaround might 
not be implemented in DBI/RPostgreSQL.

The best fix I think is to store the timestamp as integer but then I need to 
decode it in each interface that uses api_call data. I prefer to store normal 
timestamp there instead of integer. Any other way?

Win7 x64, R 3.0.2, postgres 9.3, RPostgreSQL 0.4

Regards

Original comment by musx2...@gmail.com on 7 Dec 2013 at 1:06