Re: array_agg() NULL Handling - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: array_agg() NULL Handling
Date
Msg-id BDD5C37A-0294-487E-9B7A-337C40489B2C@kineticode.com
Whole thread Raw
In response to Re: array_agg() NULL Handling  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: array_agg() NULL Handling
List pgsql-hackers
On Sep 1, 2010, at 11:09 AM, Pavel Stehule wrote:

> Then you can eliminate NULLs with simple function
> 
> CREATE OR REPLACE FUNCTION remove_null(anyarray)
> RETURNS anyarray AS $$
> SELECT ARRAY(SELECT x FROM unnest($1) g(x) WHERE x IS NOT NULL)
> $$ LANGUAGE sql;

Kind of defeats the purpose of the efficiency of the aggregate.

Best,

David



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: array_agg() NULL Handling
Next
From: Tom Lane
Date:
Subject: Re: array_agg() NULL Handling