2

I'm trying to insert rows representing some but not all columns of a Postgres database. In particular, I am seeking to insert all columns except a timestamp column that has a default set to current timestamp.

I tried the following:

dbWriteTable(con, 'raw_results', df, append = TRUE)

However, this returned an error that indicated that one of the columns (not a timestamp) was not the appropriate format for a timestamp.

I also tried writing out an insert statement:

query_string = "INSERT INTO raw_results (col1, col2) VALUES...."
dbGetQuery(con, query_string)

This returns a Warning message:

Warning message:
In postgresqlQuickSQL(conn, statement, ...) :
  Could not create executeINSERT INTO 

How can I do a simple insert into a Postgres db via R?

helloB
  • 3,472
  • 10
  • 40
  • 87

0 Answers0