handle postgres port properly, add support for by_type couch view