RPostgreSQL and views
On 23 Feb 2009, at 16:41, Sebastian P. Luque wrote:
Hi, Is there some way to access PosgreSQL Views with RPostgreSQL? dbListTables only lists the tables, and I cannot find a similar function in the DBI nor RPostgreSQL packages that would do this nor access the view directly. Any advice welcome. Thanks.
I have not used RPostgreSQL before, and this is untested, but i guess
you could add this function to RPostgreSQL/R/PostgreSQL.R
setMethod("dbListViews", "PostgreSQLConnection",
def = function(conn, ...){
out <- dbGetQuery(conn,
"select viewname from pg_views where
schemaname !='information_schema' and schemaname !='pg_catalog'",
...)
if (is.null(out) || nrow(out) == 0)
out <- character(0)
else
out <- out[, 1]
out
},
valueClass = "character"
)
HTH
adam