Macarty - 2007-10-17

modified functions for postgresql