Questions about CommandIsReadOnly

Started by houzj.fnst@fujitsu.comalmost 5 years ago1 messages
#1houzj.fnst@fujitsu.com
houzj.fnst@fujitsu.com

Hi hackers,

When reading the code, I found that in function CommandIsReadOnly[1]---------------- if (pstmt->rowMarks != NIL) return false; /* SELECT FOR [KEY] UPDATE/SHARE */ -----------------, "select for update/share" is defined as "not read only".
[1]: ---------------- if (pstmt->rowMarks != NIL) return false; /* SELECT FOR [KEY] UPDATE/SHARE */ -----------------
if (pstmt->rowMarks != NIL)
return false; /* SELECT FOR [KEY] UPDATE/SHARE */
-----------------

And from the comment [2]---------------- * the query must be *in truth* read-only, because the caller wishes * not to do CommandCounterIncrement for it. -----------------, I think it means we need to CCI for "select for update/share ",
I am not very familiar this, is there some reason that we have to do CCI for "select for update/share " ?
Or Did I misunderstand ?

[2]: ---------------- * the query must be *in truth* read-only, because the caller wishes * not to do CommandCounterIncrement for it. -----------------
* the query must be *in truth* read-only, because the caller wishes
* not to do CommandCounterIncrement for it.
-----------------

Best regards,
houzj