| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Joe Conway <mail(at)joeconway(dot)com> |
| Cc: | Manfred Koizar <mkoi-pg(at)aon(dot)at>, Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: stddev returns 0 when there is one row |
| Date: | 2003-04-20 23:50:06 |
| Message-ID: | 19947.1050882606@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Joe Conway <mail(at)joeconway(dot)com> writes:
> Tom Lane wrote:
>> I don't have a real strong feeling about whether we should change the
>> behavior at N=1 or not. Does the SQL200x spec provide any guidance?
> The spec does have specific guidance in section
> 10.9 <aggregate function>:
> 1) If VAR_POP is specified, then the result is (S2-S1*S1/N)/N.
> 2) If VAR_SAMP is specified, then:
> A) If N is 1 (one), then the result is the null value.
> B) Otherwise, the result is (S2-S1*S1/N)/(N-1)
Okay, that probably trumps the Oracle precedent, especially seeing that
it seems mathematically sounder. I'll make the changes.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kevin Brown | 2003-04-21 00:46:30 | Re: [SQL] Yet Another (Simple) Case of Index not used |
| Previous Message | Neil Conway | 2003-04-20 21:01:54 | Re: Documentation |