On 24.01.25 00:20, Paul Jungwirth wrote:
What about caching the FK's query plan? Could the RESTRICT test ever reuse the constraint oid from the NO ACTION tests just above it? I'm pretty sure that's not supposed to happen, but if it used a plan generated from the NO ACTION SQL, it would exhibit the behavior we're seeing. It also makes sense why it only appeared after 1772d554b0.

I think this call in ri_restrict()

    ri_BuildQueryKey(&qkey, riinfo, RI_PLAN_RESTRICT);

needs to use a different third argument for NO ACTION vs. RESTRICT, since we are now sometimes using different queries for them.

However, the RI_QueryKey also uses the constraint OID as part of the hash key, so even this mistake would not trigger any bad effect unless we also have OID collisions?

I'm also not able to reproduce this exact regression.diffs pattern by messing with various conditionals in ri_restrict(), to intentionally cause a confusion between the NO ACTION and RESTRICT cases.

Nevertheless, this line of investigation seems most plausible to me at the moment.



Reply via email to