Excuse me for asking probably stupid questions... From: houzj.f...@fujitsu.com <houzj.f...@fujitsu.com> > As far as I can see, it’s only necessary to increment command id when the > INSERT command modified the referenced table.
Why do we have to increment the command ID when the INSERT's target table is a referenced table? > And INSERT command only have one target table, the modification on other > tables can happen in the following cases. > > 1) has modifyingcte which modifies the referenced table > 2) has modifying function which modifies the referenced table. > (If I missed something please let me know) Also, why do we need CCI in these cases? What kind of problem would happen if we don't do CCI? > Since the above two cases are not supported in parallel mode(parallel unsafe). > IMO, It seems it’s not necessary to increment command id in parallel mode, we > can just skip commandCounterIncrement when in parallel mode. > > + /* > + * We do not need to increment the command counter > + * in parallel mode, because any other modifications > + * other than the insert event itself are parallel unsafe. > + * So, there is no chance to modify the pk relation. > + */ > + if (IsInParallelMode()) > + needCCI = false; I'm worried about having this dependency in RI check, because the planner may allow parallel INSERT in these cases in the future. Regards Takayuki Tsunakawa