Just out of curiosity is there a reason PGDATA is not listed with the other environment variables here?:
http://www.postgresql.org/docs/9.3/interactive/libpq-envars.html
-- Adrian Klaveradrian(dot)klaver(at)aklaver(dot)com