confusing comment in tqual.c

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: confusing comment in tqual.c
Date: 2006-09-15 15:44:53
Message-ID: 871wqdqglm.fsf@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 && changed by 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 current transaction
! * Cmax != my-command))) but not by this command,
* || 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 this command, or
! * Cmax == my-command) ||
* (Xmax is not committed && the row was deleted by another transaction
* Xmax != my-transaction)))) that has not been committed
*
--- 254,269 ----
* The satisfaction of "now" requires the following:
*
* ((Xmin == my-transaction && changed by 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 by the 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 another transaction
* Xmax != my-transaction)))) that has not been committed
*

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2006-09-15 15:47:05 Re: New version of money type
Previous Message Ricardo Malafaia 2006-09-15 15:35:03 Re: polite request about syntax