pgsql-bugs@postgresql.org writes:
> SearchSys Cache: Bad cache id 27
IIRC, this is a common symptom of a plpgsql.so library that's out of
sync with your backend (ie, 7.2 backend, 7.1 plpgsql.so). I suspect
the failure is coming from a plpgsql function or trigger and has
nothing to do with the rules you showed us.
Check whether the declaration of plpgsql_call_handler points at the
right .so file.
regards, tom lane