Fix ALTER TABLE ... SET TABLESPACE for unlogged relations.
Fix ALTER TABLE ... SET TABLESPACE for unlogged relations.

Changing the tablespace of an unlogged relation did not WAL log the
creation and content of the init fork. Thus, after a standby is
promoted, unlogged relation cannot be accessed anymore, with errors
like:
ERROR:  58P01: could not open file "pg_tblspc/...": No such file or directory
Additionally the init fork was not synced to disk, independent of the
configured wal_level, a relatively small durability risk.

Investigation of that problem also brought to light that, even for
permanent relations, the creation of !main forks was not WAL logged,
i.e. no XLOG_SMGR_CREATE record were emitted. That mostly turns out not
to be a problem, because these files were created when the actual
relation data is copied; nonexistent files are not treated as an error
condition during replay. But that doesn't work for empty files, and
generally feels a bit haphazard. Luckily, outside init and main forks,
empty forks don't occur often or are not a problem.

Add the required WAL logging and syncing to disk.

Reported-By: Michael Paquier
Author: Michael Paquier and Andres Freund
Discussion: 8131f8ea2415a9c7d6398dd5fc69d510a8885f8d@alap3.anarazel.de
Backpatch: 9.1, where unlogged relations were introduced

jmcatamney/gpdb,xinzweb/gpdb,ashwinstar/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,jmcatamney/gpdb,lisakowen/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,adam8157/gpdb,adam8157/gpdb,50wu/gpdb,lisakowen/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,50wu/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,50wu/gpdb,50wu/gpdb,lisakowen/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,lisakowen/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,xinzweb/gpdb,adam8157/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,50wu/gpdb,lisakowen/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,adam8157/gpdb,xinzweb/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,xinzweb/gpdb,greenplum-db/gpdb,lisakowen/gpdb