postgres driver refactored to use single-dispatch generic functions