[R-sig-DB] dbWriteTable of RPostgreSQL can't insert data into PostgreSQL Server.

Prof Brian Ripley r|p|ey @end|ng |rom @t@t@@ox@@c@uk
Sun Feb 6 08:18:14 CET 2011


On Sun, 6 Feb 2011, Tomoaki NISHIYAMA wrote:

> Hi,
>
> Xiaobo Gu wrote:
>
> | 1. If there are text data with Chinese character, then data will not
> | be inserted into database server even there is only one column of the
> | dataframe.
> | 2. I can send you the sample data which can't be inserted.
>
> This could perhaps happen if the character encoding is not appropriately set.
> Refer to http://www.postgresql.org/docs/8.4/interactive/multibyte.html
> for the Postgresql side.
>
> For proper operation, the client encoding should match the encoding of the 
> file produced by write.table.
> As this write.table encoding cannot be changed right now,
> you check the write.table encoding and set client encoding.
>
> According to
> http://cran.r-project.org/doc/manuals/R-data.pdf
> "as from R 2.13.0 write.table has a fileEncoding argument"
> So, after that, we may be able to set the encoding properly relatively easily 
> (automatically),
> but not with 2.12.X.

That is simply wrong.  fileEncoding is a convenience for those too 
intellectually challenged to be able to use a file() connection, 
something which was always supported.

>
> No special care is taken for the encoding in RPostgreSQL and
> we currently don't have tests for non-ascii text.
> We might be able to make some test for UTF-8, but supporting every
> possible encoding does not seem doable.
> -- 
> Tomoaki
>
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-db
>

-- 
Brian D. Ripley,                  ripley using stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-sig-DB mailing list