title: PostgreSQL 10 Logical Replication: Double entries or primary key conflict
body: <p>I have built a master -> slave setup with PostgreSQL 10 to sync data from some specific tables to the slave machine, which is the public system. Now during the whole time, I encounter some strange behaviour: Some tables do not sync at all.</p>
  
  <p><strong>Looking into the PostgreSQL log I encounter these error messages:</strong></p>
  
  <pre><code>2018-06-07 15:28:30.163 CEST [4134] LOG:  worker process: logical replication worker for subscription 18249 sync 17956 (PID 6706) exited with exit code 1
  
  2018-06-07 15:28:30.183 CEST [6707] ERROR:  duplicate key value violates unique constraint "producttext_pk"
  
  2018-06-07 15:28:30.183 CEST [6707] DETAIL:  Key (id)=(100) already exists.
  
  2018-06-07 15:28:30.183 CEST [6707] CONTEXT:  COPY producttext, line 1
  </code></pre>
  
  <p>For further analysis, I removed the primary key on this table on the slave machine and in this case, the error doesn't occur anymore, BUT now I get duplicate entries in the table.</p>
  
  <p>The only way to prevent the duplicate entries is to have the primary key in place, but then the sync won't work while it keeps looping on exactly four tables, never moving to the remaining ones.</p>
  
  <p>I checked the roles and owner already and those are set correctly. As said without the primary key everything syncs, doesn't throw errors, but creates duplicate entries.</p>
  
  <p>May I possibly missed something at this point? Thanks a lot.</p>