Semantics for using pgsql API have changed quite heavily with this commit. See the examples for more information. Based on Github issue #95 by PauloMelo (paulo.melo@vintageform.pt) with several modifications by me.