Re: what data type should be returned by sum(float4)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>
Cc: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: what data type should be returned by sum(float4)
Date: 2014-09-08 02:20:31
Message-ID: 31561.1410142831@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com> writes:
> The documentation says that return type of sum(expression) is...
> bigint for smallint or int arguments, numeric for bigint arguments,
> double precision for floating-point arguments, otherwise the same
> as the argument data type

> Does it expect sum(float4) returns float8, doesn't it?

Good catch! [ digs in commit history... ] It looks like the claim
that sum(float4) produces float8 was introduced in my commit
d06ebdb8d3425185d7e641d15e45908658a0177d of 2000-07-17; but it seems
to have been an outright error, because sum(float4) was a separate
aggregate long before that. Possibly a copy-and-paste mistake from
some other aggregate? I sure don't remember.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-09-08 02:44:18 Re: proposal (9.5) : psql unicode border line styles
Previous Message Kouhei Kaigai 2014-09-08 00:10:57 what data type should be returned by sum(float4)