Jeff Janes writes:
> On Sun, Nov 20, 2016 at 2:45 AM, Pavel Stehule
> wrote:
>> you can use composite type instead array too.
> I tried a composite type of (flag int, value anyelement) but you can't use
> anyelement in a composite type. So the aggregate function couldn't be
> polymorphic. Or,
2016-11-20 20:18 GMT+01:00 Jeff Janes :
> On Sun, Nov 20, 2016 at 2:45 AM, Pavel Stehule
> wrote:
>
>>
>>
>> 2016-11-19 22:12 GMT+01:00 Jeff Janes :
>>
>>> I need "strict" MIN and MAX aggregate functions, meaning they return
>>> NULL upon any NULL input, and behave like the built-in aggregates if
On Sun, Nov 20, 2016 at 2:45 AM, Pavel Stehule
wrote:
>
>
> 2016-11-19 22:12 GMT+01:00 Jeff Janes :
>
>> I need "strict" MIN and MAX aggregate functions, meaning they return NULL
>> upon any NULL input, and behave like the built-in aggregates if none of the
>> input values are NULL.
>>
>> This do
Jeff Janes schrieb am 19.11.2016 um 22:12:
I need "strict" MIN and MAX aggregate functions, meaning they return
NULL upon any NULL input, and behave like the built-in aggregates if
none of the input values are NULL.
This doesn't seem like an outlandish thing to want, and I'm surprised
I can't fi
2016-11-19 22:12 GMT+01:00 Jeff Janes :
> I need "strict" MIN and MAX aggregate functions, meaning they return NULL
> upon any NULL input, and behave like the built-in aggregates if none of the
> input values are NULL.
>
> This doesn't seem like an outlandish thing to want, and I'm surprised I
> c
> CREATE OR REPLACE FUNCTION strict_min_agg (anyarray,anyelement )
> RETURNS anyarray LANGUAGE sql IMMUTABLE AS $$
> SELECT CASE
> WHEN $1 IS NULL THEN ARRAY[$2]
> WHEN $1[1] IS NULL THEN $1
> WHEN $2 IS NULL THEN ARRAY[$2] -- use $2 not NULL to preserve
I need "strict" MIN and MAX aggregate functions, meaning they return NULL
upon any NULL input, and behave like the built-in aggregates if none of the
input values are NULL.
This doesn't seem like an outlandish thing to want, and I'm surprised I
can't find other discussion of it. Perhaps because n