fix PL/pgSQL that logs deletes