From: | "Ian Caulfield" <ian(dot)caulfield(at)gmail(dot)com> |
---|---|
To: | |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: array_agg and array_accum (patch) |
Date: | 2008-10-26 20:08:51 |
Message-ID: | 27bbfebe0810261308m3496c484q62cc327214bdcc4c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I think array_agg also keeps nulls - although the draft standard I
have seems to contradict itself about this...
Ian
2008/10/26 Jeff Davis <pgsql(at)j-davis(dot)com>:
> Here is a patch to support two aggregate functions:
>
> 1) ARRAY_AGG() -- SQL 2008 standard behavior, returns NULL on no input,
> and skips NULL inputs.
>
> 2) ARRAY_ACCUM() -- Returns empty array on no input, and includes NULL
> inputs.
>
> These accumulate the result in a memory context that lives across calls
> to the state function, so it's reasonably efficient. On my old laptop it
> takes about 5s to generate an array of 1M elements -- not great, but at
> least it's linear.
>
> Although array_agg is the standard behavior, array_accum is important
> because otherwise you always lose the NULLs, and that's difficult to
> work around even with COALESCE.
>
> I added them as new native functions because ARRAY_AGG is in the
> standard, but if others think they should live elsewhere that's fine. I
> think that they are generally pretty useful functions for people using
> arrays.
>
> This patch is contributed by Truviso.
>
> Regards,
> Jeff Davis
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-10-26 20:31:28 | Re: new correlation metric |
Previous Message | Jeff Davis | 2008-10-26 20:08:32 | Re: new correlation metric |