Closed jangorecki closed 6 years ago
See dbWriteTable2 in the caroline package, which is a wrapper of dbWriteTable that deals with named columns and serials.
@tomoakin any chance to have this simple change added to next CRAN release?
Column are matched as of 2013-06-21. Check the thread to the end https://groups.google.com/forum/#!msg/rpostgresql-dev/hIilIO_MtYk/vNAnj5x2JHsJ
There was a long time gap in CRAN release between the RPostgreSQL_0.4 on 2013-03-27 and RPostgreSQL_0.4-1 on 2016-05-08. WIth this long time gap, the version in CRAN did not match the column names.
There should be no need for an additional argument match.cols.
Was already discussed, cannot find an issue here for that so creating this one. Was already developed by Piecemaker as additional argument
match.cols
. I've put minor patch to handle cases where table doesn't exists. Compare to latest stable from CRAN: https://github.com/cran/RPostgreSQL/compare/master...jangorecki:newfeatures There is an important use case where matching columns will give nice benefit - having a table with primary key column for which values are generated from sequence, so we want to skip this column in writing to db. This is currently not possible. After solving issue this SO can be updated: https://stackoverflow.com/questions/26449666/how-do-i-write-data-from-r-to-postgresql-tables-with-an-autoincrementing-primary and this one: https://stackoverflow.com/questions/22153034/how-to-use-column-defaults-with-dbwritetable-append-true-in-rpostgresql