Fixing pg build.

refs #2499
- Properly reference pg client
- Fix broken sql queries