RPostgres icon indicating copy to clipboard operation
RPostgres copied to clipboard

`dbListObjects()`: allow `Id()` objects only as `prefix`

Open dpprdan opened this issue 3 years ago • 0 comments

This is an attempt to only allow Id() objects as prefix argument to dbListObjects() as mentioned in https://github.com/r-dbi/RPostgres/pull/372#issuecomment-1003884250.

prefix can now be a list with multiple Id objects, so querying all tables in all schemata a user has access to like this works:

con <- postgresDefault()
tbl <- dbListObjects(con)$table
head(dbListObjects(con, tbl))
dbDisconnect(con)

I am not sure, though, whether this was the intent for using vlapply() and vcapply() here previously or whether I am missing good reasons against making prefix in dbListObjects() vectorised?

Wouldn't it be cleaner though, to only have an Id method (and one for MISSING) for dbListObjects() instead of an ANY one? But that would require those changes be made to DBI (and other DBI-related packages), as well. I am probably missing something there as well.

dpprdan avatar Jan 29 '22 18:01 dpprdan