pg query null handler