I'm accessing a PostgreSQL database through the R library RPostgreSQL. The following line successfully reads my table into object DF:
DF <- dbReadTable(conn = con, name = c("my_schema","my_table"))
However, attempting to write back into the database with the following line throws ERROR: permission denied for schema my_schema:
dbWriteTable(conn = con, name = c("my_schema", "my_table"), value = DF)
I've discovered from the question Writing to specific schemas with RPostgreSQL that the solution is to SET search_path = my_schema, public;
, but I have no idea how to run this from the R Console. I've tried lines such as dbSendQuery(conn = con, statement = "SET search_path = my_schema, public;")
, and I recognize that setting permissions is not querying at all, but there's not a dbSetPermissions function in RPostgreSQL.
I'm clearly missing something fundamental since the answer to the aforementioned question satisfied the user who asked it, so I appreciate your patience.