Message-ID: <15FB564D-5D88-43E2-9989-1B3738EB7516@witneyweb.org>
Date: 2009-02-23T17:05:16Z
From: adam_pgsql
Subject: RPostgreSQL and views
In-Reply-To: <87ocwt6r7i.fsf@patagonia.sebmags.homelinux.org>
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