1616 * Portions Copyright (c) 1994, Regents of the University of California
1717 *
1818 * IDENTIFICATION
19- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.47 2002/01/1620:29:02 tgl Exp $
19+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.48 2002/01/1623:09:09 momjian Exp $
2020 *
2121 *-------------------------------------------------------------------------
2222 */
@@ -38,9 +38,12 @@ boolReferentialIntegritySnapshotOverride = false;
3838
3939/*
4040 * HeapTupleSatisfiesItself
41- *True iff heap tuple is valid for "itself."
42- *"itself" means valid as of everything that's happened
43- *in the current transaction, _including_ the current command.
41+ *
42+ *Visible tuples are those of:
43+ *
44+ *transactions committed before our _command_ started (READ COMMITTED)
45+ *previous commands of this transaction
46+ *changes made by the current command
4447 *
4548 * Note:
4649 *Assumes heap tuple is valid.
@@ -153,10 +156,13 @@ HeapTupleSatisfiesItself(HeapTupleHeader tuple)
153156
154157/*
155158 * HeapTupleSatisfiesNow
156- *True iff heap tuple is valid "now."
157- *"now" means valid including everything that's happened
158- * in the current transaction _up to, but not including,_
159- * the current command.
159+ *
160+ *Visible tuples are those of:
161+ *
162+ *transactions committed before our _command_ started (READ COMMITTED)
163+ *previous commands of this transaction
164+ *
165+ *Does _not_ include changes made by the current command
160166 *
161167 * Note:
162168 *Assumes heap tuple is valid.
@@ -296,11 +302,12 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple)
296302
297303/*
298304 * HeapTupleSatisfiesToast
299- *True iff heap tuple is valid for TOAST usage.
305+ *
306+ *Valid if the heap tuple is valid for TOAST usage.
300307 *
301308 * This is a simplified version that only checks for VACUUM moving conditions.
302309 * It's appropriate for TOAST usage because TOAST really doesn't want to do
303- * its own time qual checks; if you can see the main- table row that contains
310+ * its own time qual checks; if you can see the main table row that contains
304311 * a TOAST reference, you should be able to see the TOASTed value. However,
305312 * vacuuming a TOAST table is independent of the main table, and in case such
306313 * a vacuum fails partway through, we'd better do this much checking.
@@ -353,11 +360,13 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple)
353360
354361/*
355362 * HeapTupleSatisfiesUpdate
356- *Check whether a tuple can be updated.
357363 *
358- * This applies exactly the same checks as HeapTupleSatisfiesNow,
359- * but returns a more-detailed result code, since UPDATE needs to know
360- * more than "is it visible?"
364+ *Same as HeapTupleSatisfiesNow, but returns more information needed
365+ *by UPDATE.
366+ *
367+ * This applies the same checks as HeapTupleSatisfiesNow,
368+ * but returns a more detailed result code, since UPDATE needs to know
369+ * more than "is it visible?".
361370 */
362371int
363372HeapTupleSatisfiesUpdate (HeapTuple htuple )
@@ -475,9 +484,13 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple)
475484return HeapTupleUpdated ;/* updated by other */
476485}
477486
478- /*
479- * HeapTupleSatisfiesDirty
480- *True iff heap tuple is valid, including effects of concurrent xacts.
487+ /* HeapTupleSatisfiesDirty
488+ *
489+ *Visible tuples are those of:
490+ *
491+ *_any_ in-progress transaction
492+ *previous commands of this transaction
493+ *changes by the current command
481494 *
482495 * This is essentially like HeapTupleSatisfiesItself as far as effects of
483496 * the current transaction and committed/aborted xacts are concerned.
@@ -601,11 +614,20 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
601614
602615/*
603616 * HeapTupleSatisfiesSnapshot
604- *True iff heap tuple is valid for the given snapshot.
617+ *
618+ *Visible tuples are those of:
619+ *
620+ *transactions committed before our transaction started (SERIALIZABLE)
621+ *previous commands of this transaction
622+ *
623+ *Does _not_ include:
624+ *transactions in-progress when our transaction started
625+ *transactions committed after our transaction started
626+ *changes made by the current command
605627 *
606628 * This is the same as HeapTupleSatisfiesNow, except that transactions that
607629 * were in progress or as yet unstarted when the snapshot was taken will
608- * be treated as uncommitted, even if theyreally have committed by now.
630+ * be treated as uncommitted, even if they have committed by now.
609631 *
610632 * (Notice, however, that the tuple status hint bits will be updated on the
611633 * basis of the true state of the transaction, even if we then pretend we
@@ -746,8 +768,13 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
746768
747769
748770/*
749- * HeapTupleSatisfiesVacuum - determine tuple status for VACUUM and related
750- *operations
771+ * HeapTupleSatisfiesVacuum
772+ *
773+ *Visible tuples are those of:
774+ *
775+ *tuples visible by any running transaction
776+ *
777+ *Used by VACUUM and related operations.
751778 *
752779 * OldestXmin is a cutoff XID (obtained from GetOldestXmin()).Tuples
753780 * deleted by XIDs >= OldestXmin are deemed "recently dead"; they might