block by NelsonMinar 5612580

Patch for PostgresSQL bug on Macs. Modified slightly from upstream fix so that it applies cleanly. Originally from https://github.com/postgres/postgres/commit/6563fb2b45146852601e63828308fe04fb03b9e9

patch