Writing in data frame mode is only for new database tables (or for
overwriting an existing one). It will save all column names as they
appear in R, along with column data types and attributes. This is
done by adding metadata to a lookup table in the table's schema
named ".R_df_defs" (will be created if not present). It also adds
two fields with fixed names to the database table: ".R_rownames"
(storing the row.names of the data frame), and ".db_pkid", which is
a new integer primary key. Existing columns in the data.frame
matching these names will be automatically changed.
The rpostgis
database table read functions
dbReadDataFrame
and pgGetGeom
will use the metadata
created in data frame mode to recreate a data.frame in R, if it is
available. Otherwise, it will be imported using default
RPostgreSQL::dbGetQuery
methods.
All Spatial*DataFrame
s must be written with pgInsert
.
For more flexible writing of data.frame
s to the database
(including all writing into existing database tables), use
pgInsert
with df.mode = FALSE
.