Skip site navigation (1) Skip section navigation (2)

Re: array_agg() NULL Handling

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: array_agg() NULL Handling
Date: 2010-09-01 18:12:37
Message-ID: BDD5C37A-0294-487E-9B7A-337C40489B2C@kineticode.com (view raw or flat)
Thread:
Lists: 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


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-09-01 18:23:32
Subject: Re: array_agg() NULL Handling
Previous:From: Pavel StehuleDate: 2010-09-01 18:09:48
Subject: Re: array_agg() NULL Handling

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group