Jelte Fennema-Nio <postg...@jeltef.nl> writes: > I got a report on the PgBouncer repo[1] that running DISCARD ALL was > not sufficient between connection handoffs to force replanning of > stored procedures. Turns out that while DISCARD AL and DISCARD PLAN > reset the plan cache they do not reset the num_custom_plans fields of > the existing PlanSources. So while the generic plan is re-planned > after DISCARD ALL, the decision on whether to choose it or not won't > be changed.
Hm, should it be? That's hard-won knowledge, and I'm not sure there is a good reason to believe it's no longer applicable. Note that any change in behavior there would affect prepared statements in general, not only plpgsql. regards, tom lane