[R-sig-DB] How to write to database schema other than public using RPostgreSQL

Tomoaki NISHIYAMA tomoakin at kenroku.kanazawa-u.ac.jp
Sun Mar 6 07:39:47 CET 2011


Since so many inquiry on schema access have been received,
I have made a trial implementation and committed to the svn repository
as r176.

Pleasy try to use c("schema", "table") to the place where you want to  
refer "schema"."table".

The modification of the code is kept very minimal just add an option  
of collapse="." to paste
in comparison to the postgresqlQuoteId.  However since this function  
was used to quote vector
and return the quoted vector for the table definition construction,  
the new function was made
under a different name, as "postgresqlTableRef".  This name might not  
be optimal as this can
be also used for "table"."column" structure construction.  If any  
better name is proposed,
I will change.

Although some brief tests have been done, I personally do not depend  
on schema now and
there might be shortcomings.  So, don't hesitate to tell me if  
something is wrong.


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

On 2011/03/05, at 21:32, Xiaobo Gu wrote:

> Hi,
> It seems there is not a shcema parameter for method dbWriteTable, and
> I have tried
> "[schema].[testtable]", "\"schema\".\"testtable\", "schema.testtable"
> for the tablename parameter of dbWriteTable, none of them works.
> Do you have workarounds about this.
> Thanks,
> Xiaobo Gu
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-db

More information about the R-sig-DB mailing list