title: R - RPostgreSQL Package - dbWriteTable to non-default schema where target table contains more fields than dataframe
body: <h2>The Issue</h2>
  
  <p>I am attempting to copy the contents of an R dataframe <code>df</code> to a PostgreSQL table <code>table_name</code> located in schema <code>schema_name</code>. By default, PostgreSQL will write tables to the <code>public</code> schema and I <strong>do not</strong> want to change this setting. The two unique aspects of this transfer are:</p>
  
  <ol>
  <li>Writing to a table under a non-default schema; and</li>
  <li>The dataframe <code>df</code> contains a fewer number of fields than <code>table_name</code>. <strong>All</strong> the fields contained in <code>df</code>, however, do exist in <code>table_name</code>.</li>
  </ol>
  
  <h2>What I've Tried</h2>
  
  <p>I first attempted to use <code>dbWriteTable</code> from the <code>RPostgreSQL</code> package by using a workaround:</p>
  
  <p><code>dbWriteTable(con, c("schema_name","table_name"), df, append = T)</code></p>
  
  <p>resulting in the following exception:</p>
  
  <pre><code>Error in postgresqlgetResult(new.con) : 
    RS-DBI driver: (could not Retrieve the result : ERROR:  missing data for column "extra_col"
  CONTEXT:  COPY df, line 1: " [removed contents] "
  </code></pre>
  
  <p>I then attempted to us <code>dbWriteTable2</code> from the <code>caroline</code> package (a wrapper for the aforementioned <code>dbWriteTable</code> function), but the non-default schema hack employed above does not appear to work:</p>
  
  <p><code>dbWriteTable2(con, c("schema_name","table_name"), df, append = T, add.id = FALSE)</code></p>
  
  <p>creates the following exception:</p>
  
  <pre><code>creating NAs/NULLs for for fields of table that are missing in your df 
  Error in postgresqlExecStatement(conn, statement, ...) : 
  RS-DBI driver: (could not Retrieve the result : ERROR:  relation "schema_name" does not exist 
  LINE 1: SELECT * FROM schema_name ORDER BY id DESC LIMIT 1
  </code></pre>