I'm in R trying to run a query on a local Postgres database that has some cable TV provider data in it. Using DBI::dbGetQuery, I'm attempting to run a simple query on this database, which has a simple nested tables-inside-schemas sort of structure. Here's my connection code:
pg <- dbDriver("PostgreSQL")
con <- dbConnect(pg, user = "postgres",
password = "password",
host = "localhost",
port = 5432,
dbname = "db1")
All good so far -- if I run dbListTables(con), I get the right list of tables.
The tricky part is running the following query:
test_get <- dbGetQuery(con, "select * from provider.Provider_Composite limit 5;")
This throws the following error:
Error in postgresqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not Retrieve the result : ERROR: relation "provider.provider_composite" does not exist
LINE 1: select * from provider.Provider_Composite limit 5;
^
If I take the quoted portion of the R command (the actual postgres query, in other words) and paste it right into PGAdmin, for example, it pulls the correct table. But inside the dbGetQuery command in R, it doesn't work.
Any thoughts?