This can be fixed by making all the pgagroal_*_long() functions operate on long long instead of long, but I can't evaluate if this would break anything else.