Remove special case for xmin == xmax in HeapTupleSatisfiesVacuum().
Remove special case for xmin == xmax in HeapTupleSatisfiesVacuum().

VACUUM was willing to remove a committed-dead tuple immediately if it was
deleted by the same transaction that inserted it.  The idea is that such a
tuple could never have been visible to any other transaction, so we don't
need to keep it around to satisfy MVCC snapshots.  However, there was
already an exception for tuples that are part of an update chain, and this
exception created a problem: we might remove TOAST tuples (which are never
part of an update chain) while their parent tuple stayed around (if it was
part of an update chain).  This didn't pose a problem for most things,
since the parent tuple is indeed dead: no snapshot will ever consider it
visible.  But MVCC-safe CLUSTER had a problem, since it will try to copy
RECENTLY_DEAD tuples to the new table.  It then has to copy their TOAST
data too, and would fail if VACUUM had already removed the toast tuples.

Easiest fix is to get rid of the special case for xmin == xmax.  This may
delay reclaiming dead space for a little bit in some cases, but it's by far
the most reliable way to fix the issue.

Per bug #5998 from Mark Reid.  Back-patch to 8.3, which is the oldest
version with MVCC-safe CLUSTER.

pavanvd/postgres-xl,ashwinstar/gpdb,greenplum-db/gpdb,kmjungersen/PostgresXL,xinzweb/gpdb,zeroae/postgres-xl,adam8157/gpdb,kmjungersen/PostgresXL,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,zeroae/postgres-xl,ashwinstar/gpdb,arcivanov/postgres-xl,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,pavanvd/postgres-xl,kmjungersen/PostgresXL,arcivanov/postgres-xl,lisakowen/gpdb,lisakowen/gpdb,greenplum-db/gpdb,postmind-net/postgres-xl,adam8157/gpdb,zeroae/postgres-xl,tpostgres-projects/tPostgres,tpostgres-projects/tPostgres,yazun/postgres-xl,jmcatamney/gpdb,xinzweb/gpdb,kmjungersen/PostgresXL,xinzweb/gpdb,techdragon/Postgres-XL,adam8157/gpdb,lisakowen/gpdb,jmcatamney/gpdb,snaga/postgres-xl,jmcatamney/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,xinzweb/gpdb,xinzweb/gpdb,Postgres-XL/Postgres-XL,lisakowen/gpdb,lisakowen/gpdb,postmind-net/postgres-xl,yazun/postgres-xl,techdragon/Postgres-XL,arcivanov/postgres-xl,jmcatamney/gpdb,snaga/postgres-xl,tpostgres-projects/tPostgres,jmcatamney/gpdb,Postgres-XL/Postgres-XL,snaga/postgres-xl,techdragon/Postgres-XL,lisakowen/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,techdragon/Postgres-XL,jmcatamney/gpdb,pavanvd/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,ovr/postgres-xl,arcivanov/postgres-xl,arcivanov/postgres-xl,ashwinstar/gpdb,oberstet/postgres-xl,50wu/gpdb,adam8157/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,oberstet/postgres-xl,Postgres-XL/Postgres-XL,zeroae/postgres-xl,lisakowen/gpdb,postmind-net/postgres-xl,50wu/gpdb,50wu/gpdb,xinzweb/gpdb,greenplum-db/gpdb,zeroae/postgres-xl,greenplum-db/gpdb,yazun/postgres-xl,snaga/postgres-xl,ovr/postgres-xl,oberstet/postgres-xl,ovr/postgres-xl,50wu/gpdb,ovr/postgres-xl,snaga/postgres-xl,ovr/postgres-xl,kmjungersen/PostgresXL,oberstet/postgres-xl,xinzweb/gpdb,postmind-net/postgres-xl,yazun/postgres-xl,arcivanov/postgres-xl,tpostgres-projects/tPostgres,Postgres-XL/Postgres-XL,50wu/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,yazun/postgres-xl,tpostgres-projects/tPostgres,postmind-net/postgres-xl