Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-27 Thread Hitoshi Harada
2008/12/27 Tom Lane : > "Robert Haas" writes: >> Unfortunately, if we don't want to add an explicit iswindowable flag >> (and I understand that that's ugly), then I think this is the way to >> go. It's a shame that people will have to make code changes, but >> inventing a fake AggState object jus

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread Tom Lane
"Robert Haas" writes: > Unfortunately, if we don't want to add an explicit iswindowable flag > (and I understand that that's ugly), then I think this is the way to > go. It's a shame that people will have to make code changes, but > inventing a fake AggState object just to get around this problem

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread Robert Haas
> 1. Go back to Hitoshi's plan of passing WindowAggState to the > aggregates. This will require changing every one of the ten aggregates > in the core distro, as well as every third-party aggregate that has > a similar optimization; and we just have to keep our fingers crossed > that anyone who's

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread David Fetter
On Fri, Dec 26, 2008 at 02:17:29PM -0500, Tom Lane wrote: > So the alternatives I see are: > > 1. Go back to Hitoshi's plan of passing WindowAggState to the > aggregates. This will require changing every one of the ten aggregates > in the core distro, as well as every third-party aggregate that

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread Tom Lane
"Joshua D. Drake" writes: > I believe the goal should be correctness but why not both? Fix what we > can and put in place a "work around" that would be removed in 8.5? Why not both what? The driving concern here is that there might be third-party aggregates that will dump core if invoked as wind

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread Joshua D. Drake
On Fri, 2008-12-26 at 14:17 -0500, Tom Lane wrote: > Greg Stark writes: > > Yeah, it seems like adding a flag like iswindowable to aggregate > > functions is the safest option. > > So the alternatives I see are: > > 1. Go back to Hitoshi's plan of passing WindowAggState to the > aggregates.

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-26 Thread Tom Lane
Greg Stark writes: > Yeah, it seems like adding a flag like iswindowable to aggregate > functions is the safest option. I agree with Hitoshi-san: that's passing information in the wrong direction. The right direction is to make it visible to the called function which context it's being called

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-25 Thread Hitoshi Harada
2008/12/25 Pavel Stehule : > 2008/12/25 Hitoshi Harada : >> 2008/12/25 Greg Stark : >>> Yeah, it seems like adding a flag like iswindowable to aggregate functions >>> is the safest option. >>> >>> It would be nice if it represented an abstract property of the state >>> function or final function ra

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-25 Thread Pavel Stehule
2008/12/25 Hitoshi Harada : > 2008/12/25 Greg Stark : >> Yeah, it seems like adding a flag like iswindowable to aggregate functions >> is the safest option. >> >> It would be nice if it represented an abstract property of the state >> function or final function rather than just "works with the impl

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-25 Thread Hitoshi Harada
2008/12/25 Greg Stark : > Yeah, it seems like adding a flag like iswindowable to aggregate functions > is the safest option. > > It would be nice if it represented an abstract property of the state > function or final function rather than just "works with the implementation > of window functions".

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-25 Thread Greg Stark
Yeah, it seems like adding a flag like iswindowable to aggregate functions is the safest option. It would be nice if it represented an abstract property of the state function or final function rather than just "works with the implementation of window functions". I'm not sure what that prope

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-24 Thread Hitoshi Harada
2008/12/25 Tom Lane : > Gregory Stark writes: >> Tom Lane writes: >>> Unless we want to move the goalposts on what an aggregate is allowed >>> to do internally, we're going to have to change this to re-aggregate >>> repeatedly. Neither prospect is appetizing in the least. > >> Does it currently

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-24 Thread Tom Lane
Gregory Stark writes: > Tom Lane writes: >> Unless we want to move the goalposts on what an aggregate is allowed >> to do internally, we're going to have to change this to re-aggregate >> repeatedly. Neither prospect is appetizing in the least. > Does it currently copy the state datum before ca

Re: [HACKERS] Window-functions patch handling of aggregates

2008-12-23 Thread Gregory Stark
Tom Lane writes: > The window functions patch is laboring under the delusion that it can > call an aggregate's final function and then go back to invoking the > transfn some more on the same data. This is merest fantasy :-( > > regression=# select array_agg(q1) over(order by q1) from int8_tbl; >