#866: PgSQL fixes.
Merge pull request #85 from JohnFLewis/patch-2

#866: PgSQL fixes.