Postgres - cast row_number() to integer to match input from java