Tomasz Myrta <[EMAIL PROTECTED]> writes:
> Standard Postgresql aggregate functions don't need sorted data, but my 
> function needs. Look at the data:
> <value>   <sum>
> 3       3
> -2        1
> 6         7 *** max_sum=7
> -3        4
> 2         6

But if the input data is sorted into increasing order, then the largest
running sum value is always at the end.  Therefore max(sum()) is
equivalent to sum(); therefore you do not need the special aggregate,
nor the ordering.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to