cast to INTEGER instead of UNSIGNED for postgresql compatibility