I think the condition can be just if (contain_volatile_functions(cstate->whereClause)) { ... }
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных