Skip to content
Prev 752 / 1559 Next

Some helper functions for RPostgreSQL

Hi,

In light of the recent thread on dbWriteTable() (RPostgreSQL):

https://stat.ethz.ch/pipermail/r-sig-db/2009q4/000741.html
OR
http://article.gmane.org/gmane.comp.lang.r.db/297

I've attached some functions that I had written for my specific use
case (see below). I am not sure if they are at all useful for the
RPostgreSQL package, but if needed I can attempt to clean them up.
Even otherwise, if anyone finds them useful, feel free to use them.
The functions are "sufficiently" commented, I am not saying they are
well documented!

Use case (or more precisely, *restrictions*):
1. RedHat Linux 5.3

2. postgresql 8.1.18-2  (yes, an old version) - some of my issues were
fixed in the newer versions

3. I cannot access the db as 'postgres' user. Instead I'm given a
separate user/role/db wherein I create all my tables/schemas.

4. PostgreSQL server runs on host 'pghost' (say) and my machine is
'myhost' (say) - so transferring data between local disk and the
remote postgres server has to be done over the network fist: between
local disk and remote disk (ie using ssh/scp/rsync). Of course, the
functions are generic enough to handle the situation when the pg
server is on the local machine, without resorting to ssh/rsync.

5. Lastly, the file permissions issues are taken care of using
system(....), eg: 'chmod o+rw' before transferring and changing them
back after transferring.

6. Currently R 2.8.1, so can not upgrade to RPostgreSQL 0.1-6! But
this may change in near future.

Thanks,