Finish up postgres functions