Fix race condition in DELETE RETURNING.
Fix race condition in DELETE RETURNING.

When RETURNING is specified, ExecDelete would return a virtual-tuple slot
that could contain pointers into an already-unpinned disk buffer.  Another
process could change the buffer contents before we get around to using the
data, resulting in garbage results or even a crash.  This seems of fairly
low probability, which may explain why there are no known field reports of
the problem, but it's definitely possible.  Fix by forcing the result slot
to be "materialized" before we release pin on the disk buffer.

Back-patch to 9.0; in earlier branches there is no bug because
ExecProcessReturning sent the tuple to the destination immediately.  Also,
this is already fixed in HEAD as part of the writable-foreign-tables patch
(where the fix is necessary for DELETE RETURNING to work at all with
postgres_fdw).

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