array_agg (was Re: The Axe list)

From: "Ian Caulfield" <ian(dot)caulfield(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: array_agg (was Re: The Axe list)
Date: 2008-10-15 23:33:28
Message-ID: 27bbfebe0810151633q1aac3ea8v864bea997f3cc5ec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/10/15 Ian Caulfield <ian(dot)caulfield(at)gmail(dot)com>:
> I started to look at implementing array_agg by making the existing
> intagg stuff more generic

... and here's what I've come up with.

I've currently implemented this as a contrib module to make it quicker
to develop/test.

The aggregate uses the same basic approach to memory management as
intagg, but instead of putting data into the lower bound, an extra
structure is placed just before the data, after the null bitmap. This
holds a copy of the typlen, typbyval and typalign, as well as a
pointer to the next (unaligned) free data byte. In order to avoid
breakage due to initial values being set in another aggregate, the
transition function will reject an array value where extra padding
isn't present before the data values.

The ORDER BY clause of array_agg isn't implemented - it seems that
this would work best as a generic solution to pass ordered data to
aggregates, and is beyond my ability to implement currently.

Ian

Attachment Content-Type Size
array_agg.tar.gz application/x-gzip 3.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2008-10-16 00:31:00 Re: Updates of SE-PostgreSQL 8.4devel patches
Previous Message Simon Riggs 2008-10-15 23:26:01 Re: SlruPhysicalReadPage