title: Foreign table inserts don't use the remote sequence
body: <p>I have a set of applications accessing two different PostgreSQL 9.6 DBs on the same server. Due to some application limitations, one application accesses a handful of tables via FDW in one DB to the other.</p>
  
  <p>Something like this:<br>
  <code>DB1.fdw_table_a</code> -> <code>DB2.table_a</code></p>
  
  <p><code>fdw_table_a</code> is only used for inserts of log data. This table has an <code>id</code> column, which is a <code>bigint</code> sequence. The sequence exists in DB1 (on the foreign table) and in DB2 (the "real" table). This works as it should and all is well.</p>
  
  <p>Now there's a need to have another application (again with limited access capabilities) perform inserts into the "real" table, <code>DB2.table_a</code>. In testing, I can see some inconsistencies in the <code>id</code> column, but no obvious issues have appeared.</p>
  
  <p>I can see in the customer-facing environments that the DB1 FDW sequence is used as expected, but when inserts start directly on the DB2 'real' table, that sequence will start at 1 (as it has never been used).</p>
  
  <p>Are there other things we should be considering in this environment?
  Are there some issues that could arise from overlap in these two sequences inserting into the table?</p>