Re: [GENERAL] Question about using AggCheckCallContext in a C function

2013-08-13 Thread Matt Solnit
On Aug 12, 2013, at 12:47 PM, Tom Lane wrote: > Matt Solnit writes: >> 2. The function seems to work consistently when I do a SELECT >> SUM(mycol) without any GROUP BY. It's only when I add grouping that >> the failures happen. I'm not sure if this is a real clue or a red >> herring. > > That

Re: [GENERAL] Question about using AggCheckCallContext in a C function

2013-08-12 Thread Tom Lane
Matt Solnit writes: > 2. The function seems to work consistently when I do a SELECT > SUM(mycol) without any GROUP BY. It's only when I add grouping that > the failures happen. I'm not sure if this is a real clue or a red > herring. That isn't enormously surprising, since the memory management

Re: [GENERAL] Question about using AggCheckCallContext in a C function

2013-08-12 Thread Matt Solnit
On Aug 12, 2013, at 11:53 AM, Tom Lane wrote: > Matt Solnit writes: >> After poring over the code in nodeAgg.c, and looking at the in8inc() >> function, I think I know what the problem is: the typical use of >> AggCheckCallContext() is not compatible with TOAST-able data types. > > That's non

Re: [GENERAL] Question about using AggCheckCallContext in a C function

2013-08-12 Thread Tom Lane
Matt Solnit writes: > After poring over the code in nodeAgg.c, and looking at the in8inc() > function, I think I know what the problem is: the typical use of > AggCheckCallContext() is not compatible with TOAST-able data types. That's nonsense. There are several standard aggregates that use tha

[GENERAL] Question about using AggCheckCallContext in a C function

2013-08-12 Thread Matt Solnit
Hi everyone. A while back, I wrote a function to sum array contents (think 1-D matrix addition), and am using it in a custom SUM aggregate. Here's an example: CREATE TABLE foo (arr INT[]); INSERT INTO foo VALUES ('{1, 2, 3}'), ('{4, 5, 6}'); SELECT SUM(arr) FROM foo; sum - {5,7,9