Gregory Stark <stark@enterprisedb.com> writes:
> Wait, shouldn't it be sufficient to do a CCI only in the "if (!plan)" case?
No. The problem is that if you don't do the CCI then you don't get the
invalidation events that might-or-might-not be pending in the inval
queue. So testing for whether the plan is still valid is meaningless
unless that queue's been flushed.
regards, tom lane