Re: R: R: complex custom aggregate function - Mailing list pgsql-general

From Greg Stark
Subject Re: R: R: complex custom aggregate function
Date
Msg-id 4136ffa0902020719o5b742d4x329acce529f5164d@mail.gmail.com
Whole thread Raw
In response to Re: R: R: complex custom aggregate function  (Scara Maccai <m_lists@yahoo.it>)
List pgsql-general
On Mon, Feb 2, 2009 at 2:30 PM, Scara Maccai <m_lists@yahoo.it> wrote:
> Paolo Saudin wrote:
>> I use a master table with a "fulldate" field and filled with sequential dates to
>> fill gaps when meteo data is missing.
>
> I'm sorry, I still don't get it: how can you be sure that postgresql won't call perl_sliding_mean with not-ordered
timestamps-data?I don't mean only in case of holes. 
>
> The "order by" as far as I know is usually done at the very end of the plan, so I don't think it can affect the order
ofthe data passed to the function... 


You need to make a subquery with the ORDER BY on it. Postgres won't
re-order an ORDER BY in a subquery to happen outside the outer query.

So something like

select perl_function(foo) from (select foo from table order by bar)

--
greg

pgsql-general by date:

Previous
From: Mohamed
Date:
Subject: Re: Fulltext search configuration
Next
From: "Scot Kreienkamp"
Date:
Subject: Re: Warm Standby question