We managed to patch a third-party driver to give us the functionality we needed.
https://github.com/PocketRent/hhvm-pgsql