Tom Lane wrote:
I don't understand what you think is wrong with this solution. It works
fine for me:
regression=# create view vv as
regression-# select max(unique1) from (select unique1 from tenk1
regression(# order by unique2) x;
CREATE VIEW
regression=# explain select * from vv;
Tom Lane wrote:
Tomasz Myrta writes:
>Standard Postgresql aggregate functions don't need sorted data, but my
>function needs. Look at the data:
>
>3 3
>-21
>6 7 *** max_sum=7
>-34
>2 6
But if the input data is sorted into increasing order, then the largest
ru
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> Standard Postgresql aggregate functions don't need sorted data, but my
> function needs. Look at the data:
>
> 3 3
> -21
> 6 7 *** max_sum=7
> -34
> 2 6
But if the input data is sorted into increasing order, then
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> I found I can obey this using subselect:
> select
>maxsum(X.value)
> from
> (select value
>from some_table
>order by some_field) X
> I can't create subselect, because I want to change this query into a
> view. In my case postgresql doesn't
[EMAIL PROTECTED] wrote:
Ah - so it's maximum of a running-total rather than a sum.
Sorry, my english still has a lot of black-holes :-(
AFAIK you are out of luck with aggregate functions. The order data is
supplied to them is *not* defined - the "order by" operates just before
results are ou
> Richard Huxton wrote:
>
>> On Monday 06 Jan 2003 12:44 pm, Tomasz Myrta wrote:
>>
>> >Hi
>> >I created my own aggregate function working as max(sum(value))
>> >It adds positive and negative values and finds maximum of this sum.
>> >To work properly this function needs data to be sorted.
>>
>>
>>
Richard Huxton wrote:
On Monday 06 Jan 2003 12:44 pm, Tomasz Myrta wrote:
>Hi
>I created my own aggregate function working as max(sum(value))
>It adds positive and negative values and finds maximum of this sum.
>To work properly this function needs data to be sorted.
I'm not sure that an aggre
On Monday 06 Jan 2003 12:44 pm, Tomasz Myrta wrote:
> Hi
> I created my own aggregate function working as max(sum(value))
> It adds positive and negative values and finds maximum of this sum.
> To work properly this function needs data to be sorted.
I'm not sure that an aggregate function should r
Hi
I created my own aggregate function working as max(sum(value))
It adds positive and negative values and finds maximum of this sum.
To work properly this function needs data to be sorted.
select
maxsum(value)
from some_table
order by some_field
doesn't work:
ERROR: Attribute some_table.som