Skip to content
Prev 599 / 1559 Next

RPostgreSQL and views

On 23 Feb 2009, at 16:41, Sebastian P. Luque wrote:

            
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