Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-02 Thread ian link
I'm fine with moving the operators over to functions. I just don't want to implement anything that is against best practice. If we are OK with that direction, I'll go ahead and start on the new patch. Ian On Mon, Jul 1, 2013 at 9:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig Ringer

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread ian link
Definitely not this week. Hopefully for next commit fest. On Sun, Jun 30, 2013 at 9:56 PM, Josh Berkus j...@agliodbs.com wrote: On 06/30/2013 08:54 PM, ian link wrote: I found some time and I think I am up to speed now. I finally figured out how to add new operator strategies and made a

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Robert Haas
On Sun, Jun 30, 2013 at 11:54 PM, ian link i...@ilink.io wrote: I found some time and I think I am up to speed now. I finally figured out how to add new operator strategies and made a little test operator for myself. It seems pretty clear that assuming '+' and '-' are addition and subtraction

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Alvaro Herrera
Robert Haas escribió: On Sun, Jun 30, 2013 at 11:54 PM, ian link i...@ilink.io wrote: It seems pretty clear that assuming '+' and '-' are addition and subtraction is a bad idea. I don't think it would be too tricky to add support for new operator strategies. Andrew Gierth suggested calling

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Robert Haas
On Mon, Jul 1, 2013 at 3:28 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Robert Haas escribió: On Sun, Jun 30, 2013 at 11:54 PM, ian link i...@ilink.io wrote: It seems pretty clear that assuming '+' and '-' are addition and subtraction is a bad idea. I don't think it would be too

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Josh Berkus
On 07/01/2013 12:05 AM, ian link wrote: Definitely not this week. Hopefully for next commit fest. OK, marked Returned with Feedback. It'll be up to you to add it to the next commitfest if you think it's ready by then. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Jul 1, 2013 at 3:28 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Currently, all operator classes are tied to access methods. Since nobody seems to have any great idea about creating an access method that requires addition and

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Craig Ringer
On 07/02/2013 02:39 AM, Robert Haas wrote: I'm actually not clear that it would be all that bad to assume fixed operator names, as we apparently do in a few places despite the existence of operator classes. But if that is bad, then I don't know how using @+ and @- instead helps anything.

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-07-01 Thread Tom Lane
Craig Ringer cr...@2ndquadrant.com writes: On 07/02/2013 02:39 AM, Robert Haas wrote: I'm actually not clear that it would be all that bad to assume fixed operator names, as we apparently do in a few places despite the existence of operator classes. But if that is bad, then I don't know how

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-30 Thread ian link
I found some time and I think I am up to speed now. I finally figured out how to add new operator strategies and made a little test operator for myself. It seems pretty clear that assuming '+' and '-' are addition and subtraction is a bad idea. I don't think it would be too tricky to add support

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-30 Thread Josh Berkus
On 06/30/2013 08:54 PM, ian link wrote: I found some time and I think I am up to speed now. I finally figured out how to add new operator strategies and made a little test operator for myself. It seems pretty clear that assuming '+' and '-' are addition and subtraction is a bad idea. I

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-22 Thread ian link
Thanks Craig! That definitely does help. I probably still have some questions but I think I will read through the rest of the code before asking. Thanks again! Ian Craig Ringer Friday, June 21, 2013 8:41 PM On 06/22/2013 03:30 AM, ian link wrote: Forgive my ignorance, but I don't entirely

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-21 Thread Hitoshi Harada
On Thu, Jun 20, 2013 at 7:24 PM, Craig Ringer cr...@2ndquadrant.comwrote: I've missed this feature more than once, and am curious about whether any more recent changes may have made it cleaner to tackle this, or whether consensus can be formed on adding the new entries to btree's opclass to

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-21 Thread Craig Ringer
On 06/21/2013 05:32 PM, Hitoshi Harada wrote: I also later found that we are missing not only notion of '+' or '-', but also notion of 'zero value' in our catalog. Per spec, RANGE BETWEEN needs to detect ERROR if the offset value is negative, but it is not always easy if you think about

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-21 Thread Hitoshi Harada
On Fri, Jun 21, 2013 at 3:20 AM, Craig Ringer cr...@2ndquadrant.com wrote: On 06/21/2013 05:32 PM, Hitoshi Harada wrote: I also later found that we are missing not only notion of '+' or '-', but also notion of 'zero value' in our catalog. Per spec, RANGE BETWEEN needs to detect ERROR if

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-21 Thread ian link
Forgive my ignorance, but I don't entirely understand the problem. What does '+' and '-' refer to exactly? Thanks! On Fri, Jun 21, 2013 at 4:35 AM, Hitoshi Harada umi.tan...@gmail.comwrote: On Fri, Jun 21, 2013 at 3:20 AM, Craig Ringer cr...@2ndquadrant.comwrote: On 06/21/2013 05:32 PM,

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-21 Thread Craig Ringer
On 06/22/2013 03:30 AM, ian link wrote: Forgive my ignorance, but I don't entirely understand the problem. What does '+' and '-' refer to exactly? Consider RANGE 4.5 PRECEDING'. You need to be able to test whether, for the current row 'b', any given row 'a' is within the range (b - 4.5) a = b

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-20 Thread Ian Link
I am currently looking into this feature. However, as I am quite new to Postgres, I think it might take me a while to get up to speed. Anyways, I would also appreciate another round of discussion on the future of the windowing functions. Ian Link Craig Ringer Thursday,

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-20 Thread Craig Ringer
On 06/21/2013 10:31 AM, Ian Link wrote: I am currently looking into this feature. However, as I am quite new to Postgres, I think it might take me a while to get up to speed. Anyways, I would also appreciate another round of discussion on the future of the windowing functions. Good to know,

Re: [HACKERS] Support for RANGE ... PRECEDING windows in OVER

2013-06-20 Thread Ian Link
Thanks! The discussions have been useful, although I am currently just reviewing the code. I think a good starting point will be to refactor/imrpove the WinGetFuncArgInPartition and WinGetFuncArgInFrame functions. Tom Lane wrote this about them before comitting the patch: I'm not terribly