Backport the pg_upgrade-related changes from upstream commit 3d21a0f300.
Backport the pg_upgrade-related changes from upstream commit 3d21a0f300.

This patch was backported earlier already, but now that we cherry-picked
the binary-upgrade work from 9.0, we must also pick the related parts
of 3d21a0f300, that were not applicable earlier.

In the passing, also pick the "if (secure)" checks to EchoQuery and
UseNewLine from the upstream commit. I don't know why those were not
picked earlier.

cjcjameson/gpdb,edespino/gpdb,jmcatamney/gpdb,50wu/gpdb,greenplum-db/gpdb,xinzweb/gpdb,Chibin/gpdb,adam8157/gpdb,adam8157/gpdb,xinzweb/gpdb,Chibin/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,rvs/gpdb,Chibin/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,Quikling/gpdb,janebeckman/gpdb,Quikling/gpdb,yuanzhao/gpdb,edespino/gpdb,jmcatamney/gpdb,Chibin/gpdb,yuanzhao/gpdb,50wu/gpdb,ashwinstar/gpdb,xinzweb/gpdb,cjcjameson/gpdb,xinzweb/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,edespino/gpdb,lisakowen/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,adam8157/gpdb,xinzweb/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,rvs/gpdb,cjcjameson/gpdb,janebeckman/gpdb,50wu/gpdb,Quikling/gpdb,cjcjameson/gpdb,adam8157/gpdb,janebeckman/gpdb,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,cjcjameson/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,Quikling/gpdb,adam8157/gpdb,xinzweb/gpdb,cjcjameson/gpdb,yuanzhao/gpdb,janebeckman/gpdb,rvs/gpdb,Quikling/gpdb,janebeckman/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,edespino/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,xinzweb/gpdb,Quikling/gpdb,Chibin/gpdb,adam8157/gpdb,Chibin/gpdb,edespino/gpdb,edespino/gpdb,greenplum-db/gpdb,Chibin/gpdb,rvs/gpdb,ashwinstar/gpdb,edespino/gpdb,Chibin/gpdb,50wu/gpdb,lisakowen/gpdb,Quikling/gpdb,rvs/gpdb,lisakowen/gpdb,rvs/gpdb,janebeckman/gpdb,kaknikhil/gpdb,Quikling/gpdb,janebeckman/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,rvs/gpdb,Chibin/gpdb,kaknikhil/gpdb,Quikling/gpdb,kaknikhil/gpdb,greenplum-db/gpdb,lisakowen/gpdb,kaknikhil/gpdb,rvs/gpdb,lisakowen/gpdb,50wu/gpdb,janebeckman/gpdb,yuanzhao/gpdb,50wu/gpdb,janebeckman/gpdb,Quikling/gpdb,adam8157/gpdb,rvs/gpdb,yuanzhao/gpdb,Chibin/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,lisakowen/gpdb,rvs/gpdb,edespino/gpdb,yuanzhao/gpdb,edespino/gpdb,janebeckman/gpdb,kaknikhil/gpdb,edespino/gpdb,lisakowen/gpdb,greenplum-db/gpdb,50wu/gpdb,ashwinstar/gpdb,jmcatamney/gpdb