libraries/db: actually sort pull_request query results