confusing comment in tqual.c - Mailing list pgsql-hackers

From Gregory Stark
Subject confusing comment in tqual.c
Date
Msg-id 871wqdqglm.fsf@enterprisedb.com
Whole thread Raw
Responses Re: confusing comment in tqual.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

I'm reading the code in tqual.c and find that this comment doesn't seem to
match the code. CommandId always seems to be compared with >= or <= rather
than equality as the comment says.

I'm not even sure I have these operators right as the expression as written
here is in a few places the converse case that the code actually tests. It's
also pretty confusing.

I'm not so much submitting this patch to try to correct it as to verify my
understanding of the code.


*** tqual.c    14 Sep 2006 13:54:45 +0100    1.96
--- tqual.c    15 Sep 2006 15:50:41 +0100    
***************
*** 254,269 ****  * The satisfaction of "now" requires the following:  *  * ((Xmin == my-transaction &&
changedby the current transaction
 
!  *     Cmin != my-command &&                    but not by this command, and  *        (Xmax is null ||
        the row has not been deleted, or  *            (Xmax == my-transaction &&            it was deleted by the
currenttransaction
 
!  *             Cmax != my-command)))                but not by this command,  * ||
   or  *  *    (Xmin is committed &&                    the row was modified by a committed transaction, and  *
(Xmaxis null ||                    the row has not been deleted, or  *            (Xmax == my-transaction &&
therow is being deleted by this command, or
 
!  *             Cmax == my-command) ||  *            (Xmax is not committed &&            the row was deleted by
anothertransaction  *             Xmax != my-transaction))))            that has not been committed  *
 
--- 254,269 ----  * The satisfaction of "now" requires the following:  *  * ((Xmin == my-transaction &&
changedby the current transaction
 
!  *     Cmin < my-command &&                    by an earlier command than this scan, and  *        (Xmax is null ||
                    the row has not been deleted, or  *            (Xmax == my-transaction &&            it was deleted
bythe current transaction
 
!  *             Cmax >= my-command)))                but not by a command before this scan  * ||
                or  *  *    (Xmin is committed &&                    the row was modified by a committed transaction,
and *        (Xmax is null ||                    the row has not been deleted, or  *            (Xmax == my-transaction
&&           the row is being deleted by an earlier command
 
!  *             Cmax >= my-command) ||  *            (Xmax is not committed &&            the row was deleted by
anothertransaction  *             Xmax != my-transaction))))            that has not been committed  *
 


--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Ricardo Malafaia"
Date:
Subject: Re: polite request about syntax
Next
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: New version of money type