first pass at query support for postgresql. much work remains.