Index: src/backend/access/heap/pruneheap.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/heap/pruneheap.c,v
retrieving revision 1.2
diff -c -r1.2 pruneheap.c
*** src/backend/access/heap/pruneheap.c	21 Sep 2007 21:25:42 -0000	1.2
--- src/backend/access/heap/pruneheap.c	24 Oct 2007 09:32:21 -0000
***************
*** 146,162 ****
  	int				nredirected = 0;
  	int				ndead = 0;
  	int				nunused = 0;
  
  	START_CRIT_SECTION();
  
  	/*
! 	 * Mark the page as clear of prunable tuples.  If we find a tuple which
! 	 * may soon become prunable, we shall set the hint again.  Also clear
! 	 * the "page is full" flag, since there's no point in repeating the
! 	 * prune/defrag process until something else happens to the page.
  	 */
  	PageClearPrunable(page);
! 	PageClearFull(page);
  
  	/* Scan the page */
  	maxoff = PageGetMaxOffsetNumber(page);
--- 146,173 ----
  	int				nredirected = 0;
  	int				ndead = 0;
  	int				nunused = 0;
+ 	TransactionId	save_prune_xid;
  
  	START_CRIT_SECTION();
  
  	/*
! 	 * Save the current pd_prune_xid and mark the page as clear of prunable
! 	 * tuples. If we find a tuple which may soon become prunable, we shall set
! 	 * the hint again.
  	 */
+ 	save_prune_xid = ((PageHeader) page)->pd_prune_xid;
  	PageClearPrunable(page);
! 
! 	/* 
! 	 * Also clear the "page is full" flag if it is set, since there's no point
! 	 * in repeating the prune/defrag process until something else happens to the
! 	 * page.
! 	 */
! 	if (PageIsFull(page))
! 	{
! 		PageClearFull(page);
! 		SetBufferCommitInfoNeedsSave(buffer);
! 	}
  
  	/* Scan the page */
  	maxoff = PageGetMaxOffsetNumber(page);
***************
*** 209,218 ****
  	else
  	{
  		/*
! 		 * If we didn't prune anything, we have nonetheless updated the
  		 * pd_prune_xid field; treat this as a non-WAL-logged hint.
  		 */
! 		SetBufferCommitInfoNeedsSave(buffer);
  	}
  
  	END_CRIT_SECTION();
--- 220,230 ----
  	else
  	{
  		/*
! 		 * If we didn't prune anything, but have updated the
  		 * pd_prune_xid field; treat this as a non-WAL-logged hint.
  		 */
! 		if (((PageHeader) page)->pd_prune_xid != save_prune_xid)
! 			SetBufferCommitInfoNeedsSave(buffer);
  	}
  
  	END_CRIT_SECTION();
