On Tue, Jan 12, 2010 at 04:06:20PM +0200, Sergey Levchenko wrote:
> but I have to fold it in multi-dimensional, array like {{71629130,
> 15518, 0}, {2668722, 616, 0}} ?
> but it's not possible to pass more then one argument to the array_agg
> function :/

Tuples work fine.  Multidimensional arrays are awfully complicated and
it's generally better to stay away from them, arrays of tuples make more
sense.  Maybe something like:

  CREATE TYPE meterreading (
    meter_id    INT, 
    org_reading NUMERIC,
    reading     NUMERIC
  );
  SELECT office_id, serial, commit_date, service_id,
    array_agg(row(meter_id, organization_reading, reading)::meterreading) AS 
readings
  FROM meter_readings;


-- 
  Sam  http://samason.me.uk/

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to