Re: R: R: complex custom aggregate function

From: Greg Stark <stark(at)enterprisedb(dot)com>
To: Scara Maccai <m_lists(at)yahoo(dot)it>
Cc: Paolo Saudin <paolo(at)ecometer(dot)it>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: R: R: complex custom aggregate function
Date: 2009-02-02 15:19:08
Message-ID: 4136ffa0902020719o5b742d4x329acce529f5164d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 2, 2009 at 2:30 PM, Scara Maccai <m_lists(at)yahoo(dot)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 of the 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2009-02-02 15:26:31 Re: Fulltext search configuration
Previous Message Scot Kreienkamp 2009-02-02 15:19:03 Re: Warm Standby question