Greg Stark <gsstark(at)mit(dot)edu> writes:
> Things like count(*) could use int4 until it overflows though.
I don't see a reasonable way for an aggregate to change state datatype
on the fly; otherwise this would be a great solution.
> Is int4 a pass-by-value datatype on 32-bit machines?
Yeah. Not too long ago, count() used int4, but we got some complaints
about it overflowing on big tables.
regards, tom lane