Re: numeric stddev_pop and var_pop are wrong

Lists: pgsql-bugs
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-bugs(at)postgreSQL(dot)org
Cc: student23 <student23(at)o2(dot)pl>
Subject: numeric stddev_pop and var_pop are wrong
Date: 2007-07-09 14:39:47
Message-ID: 9501.1183991987@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

When applied to "numeric" input, stddev_pop produces the same result as
stddev_samp, and var_pop produces the same result as var_samp. This
is because whoever wrote numeric_stddev_internal() forgot that the
divisor is different for the sample case. This mistake is in fact
visible in the regression test outputs for the function, so those
outputs weren't checked very carefully :-(

regards, tom lane


From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgreSQL(dot)org, student23 <student23(at)o2(dot)pl>
Subject: Re: numeric stddev_pop and var_pop are wrong
Date: 2007-07-10 06:10:55
Message-ID: 1184047855.8180.17.camel@goldbach
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, 2007-09-07 at 10:39 -0400, Tom Lane wrote:
> When applied to "numeric" input, stddev_pop produces the same result as
> stddev_samp, and var_pop produces the same result as var_samp. This
> is because whoever wrote numeric_stddev_internal() forgot that the
> divisor is different for the sample case. This mistake is in fact
> visible in the regression test outputs for the function, so those
> outputs weren't checked very carefully :-(

My fault, I'm afraid -- how embarrassing! I certainly tested the
function for numeric inputs while developing it. I can only guess that I
wrote it and tested it, then refactored and broke it, and blindly copied
the resulting regression outputs => expected...

Sorry,

Neil