Fix table syncing with different column order

Peter Eisentraut <peter_e@gmx.net>

Commit: 073ce405d68355eed36a11b41e558232ecf18201
Author: Peter Eisentraut <peter_e@gmx.net>
Date: 2017-05-24T23:40:30Z
Releases: 10.0
Fix table syncing with different column order

Logical replication supports replicating between tables with different
column order.  But this failed for the initial table sync because of a
logic error in how the column list for the internal COPY command was
composed.  Fix that and also add a test.

Also fix a minor omission in the column name mapping cache.  When
creating the mapping list, it would not skip locally dropped columns.
So if a remote column had the same name as a locally dropped
column (...pg.dropped...), then the expected error would not occur.

Files