[R-sig-DB] dbWriteTable on virtual linux box

Tomoaki NISHIYAMA tomo@k|n @end|ng |rom kenroku@k@n@z@w@-u@@c@jp
Tue Mar 1 05:02:22 CET 2011


Hi,

> dbSendQuery(conn, "SET search_path = myschema;")
> dbGetQuery(conn, "SHOW search_path")


> because the search_path only applies to the current session, and the
> session ends when dbSendQuery returns a result.


This is something different from my understanding.
dbSendQuery just sends query and does not end the session.
On the contrary, it leaves the connection open and in an unfinished  
state,
and the second dbGetQuery will open a new connection, so that you get

>      search_path
> 1 "$user",public


So, please instead try
dbGetQuery(conn, "SET search_path = myschema")
dbGetQuery(conn, "SHOW search_path")

> So is there a way to
> write to anything other than the public schema in version 0.1-7?

To my understanding,
dbGetQuery(conn, "SET search_path = myschema")
dbWriteTable(conn, "table_name", ...)
will write the dataframe to myschema.table_name
-- 
Tomoaki NISHIYAMA

Advanced Science Research Center,
Kanazawa University,
13-1 Takara-machi,
Kanazawa, 920-0934, Japan




More information about the R-sig-DB mailing list