Changed view to support legacy postgres