Fixed rownumber issues for postgress