Re: [PATCH] Negative Transition Aggregate Functions (WIP) - Mailing list pgsql-hackers

From David Rowley
Subject Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Date
Msg-id CAApHDvqieH2=BywtP-J6HHbcruZh1Jo-n0_U_hGC-M=EZ7wrWQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
Responses Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers
On Fri, Jan 17, 2014 at 3:05 PM, Florian Pflug <fgp@phlo.org> wrote:

I've now shuffled things around so that we can use inverse transition functions
even if only some aggregates provide them, and to allow inverse transition
functions to force a restart by returning NULL. The rules regarding NULL handling
are now the following


Maybe this is me thinking out loud, but I'm just thinking about the numeric case again.
Since the patch can now handle inverse transition functions returning NULL when they fail to perform inverse transitions, I'm wondering if we could add an "expectedscale" to NumericAggState, set it to -1 initially, when we get the first value set the expectedscale to the dscale of that numeric, then if we get anything but that value we'll set the expectedscale back to -1 again, if we are asked to perform an inverse transition with a expectedscale as -1 we'll return null, otherwise we can perform the inverse transition...

Thoughts?

Regards

David Rowley 

pgsql-hackers by date:

Previous
From: Gregory Smith
Date:
Subject: Re: [v9.4] row level security
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] surprising to_timestamp behavior