77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.3 1997/08/19 21:36:12 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.4 1997/08/29 09:04:54 vadim Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -580,6 +580,13 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
580580 * (Xmax is not committed && the row was deleted by another transaction
581581 * Xmax != my-transaction)))) that has not been committed
582582 *
583+ * XXX
584+ *CommandId stuff didn't work properly if one used SQL-functions in
585+ *UPDATE/INSERT(fromSELECT)/DELETE scans: SQL-funcs call
586+ *CommandCounterIncrement and made tuples changed/inserted by
587+ *current command visible to command itself (so we had multiple
588+ *update of updated tuples, etc).- vadim 08/29/97
589+ *
583590 *mao says 17 march 1993: the tests in this routine are correct;
584591 *if you think they're not, you're wrong, and you should think
585592 *about it again. i know, it happened to me. we don't need to
@@ -615,21 +622,21 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
615622if (!AbsoluteTimeIsBackwardCompatiblyValid (tuple -> t_tmin )) {
616623
617624if (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmin )
618- && CommandIdIsCurrentCommandId (tuple -> t_cmin )) {
625+ && CommandIdGEScanCommandId (tuple -> t_cmin )) {
619626
620627return (false);
621628}
622629
623630if (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmin )
624- && !CommandIdIsCurrentCommandId (tuple -> t_cmin )) {
631+ && !CommandIdGEScanCommandId (tuple -> t_cmin )) {
625632
626633if (!TransactionIdIsValid ((TransactionId )tuple -> t_xmax )) {
627634return (true);
628635 }
629636
630637Assert (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmax ));
631638
632- if (CommandIdIsCurrentCommandId (tuple -> t_cmax )) {
639+ if (CommandIdGEScanCommandId (tuple -> t_cmax )) {
633640return (true);
634641 }
635642}
@@ -813,21 +820,21 @@ HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
813820if (!AbsoluteTimeIsBackwardCompatiblyValid (tuple -> t_tmin )) {
814821
815822if (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmin )&&
816- CommandIdIsCurrentCommandId (tuple -> t_cmin )) {
823+ CommandIdGEScanCommandId (tuple -> t_cmin )) {
817824
818825return (false);
819826}
820827
821828if (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmin )&&
822- !CommandIdIsCurrentCommandId (tuple -> t_cmin )) {
829+ !CommandIdGEScanCommandId (tuple -> t_cmin )) {
823830
824831if (!TransactionIdIsValid ((TransactionId )tuple -> t_xmax )) {
825832return (true);
826833 }
827834
828835Assert (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmax ));
829836
830- return ((bool ) !CommandIdIsCurrentCommandId (tuple -> t_cmax ));
837+ return ((bool ) !CommandIdGEScanCommandId (tuple -> t_cmax ));
831838}
832839
833840if (!TransactionIdDidCommit ((TransactionId )tuple -> t_xmin )) {
@@ -849,7 +856,8 @@ HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
849856}
850857
851858if (TransactionIdIsCurrentTransactionId ((TransactionId )tuple -> t_xmax )) {
852- return (CommandIdIsCurrentCommandId (tuple -> t_cmin ));
859+ return (CommandIdGEScanCommandId (tuple -> t_cmin ));
860+ /* it looks like error ^^^^ */
853861}
854862
855863if (!TransactionIdDidCommit ((TransactionId )tuple -> t_xmax )) {