... oh, one other point is that using %ld to print an int64 is entirely not portable, as indeed the cfbot is complaining about.
I think our best practice on that is to put %lld in the format string and explicitly cast the corresponding argument to "long long". regards, tom lane