An aggregate function on ARRAY

From: Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: An aggregate function on ARRAY
Date: 2010-08-11 12:42:32
Message-ID: 1281530552.3141.75.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've started using ARRAY data type recently, and I fell into the
following problem:

When I have a relatively large ARRAY (like [1:500]) takeing an aggregate
function on its elements is not so easy. One has to iterate all the
elements, like this:

SELECT min(A[1]) as a1, min(A[2]) as a2, ...

This is because aggregate functions are not defined on ARRAY types. Or
may be there is an easier and more readable way to do that?

-R

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2010-08-11 13:48:06 Re: Is there a way to bypass sql?
Previous Message Davor J. 2010-08-11 12:35:59 How-to question: pre-parsing and pre-planning dynamic sql statements