Hi, while looking at the pluggable storage patch I noticed that validateForeignKeyConstraint() calls RI_FKey_check() for each row without resetting a memory / expression context. There's not too much leakage in the called code, but there's some I think.
Greetings, Andres Freund