> Is there a better way?
I think you could use a User Data Type.
Then pass that as parameter to your aggregate function.
That is: you would pass
(4, 'meter')
(400, 'mm')
(100, 'cm')
to your aggregate function.
Each one is a user datatype:
CREATE TYPE mytype AS (
v double precision,
t varchar(10)
);
See
http://www.postgresql.org/docs/8.4/static/rowtypes.html
This is the example based on a custom data type of complex numbers:
http://www.postgresql.org/docs/8.4/static/xaggr.html