Refactor triggers, search path utils out of Postgres