Move Long coercion to db functions