I added a trigger and function in postgres