Fix postgres api implementation