Re: multiple paramters in aggregate function - Mailing list pgsql-general

From Sim Zacks
Subject Re: multiple paramters in aggregate function
Date
Msg-id 4A840C2B.6090309@compulab.co.il
Whole thread Raw
In response to Re: multiple paramters in aggregate function  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Responses Re: multiple paramters in aggregate function
List pgsql-general
> It's probably easiest to decide on an internal unit to use in your
> aggregate and only convert it to the desired unit once you're done
> summing them. I'd probably convert all measurements to mm in the
> function and summarise those.
That could work in some cases, however in our case it would not produce
desirable results. If the user put in meters, he is expecting to see
meters. My problem comes in only when the user put in values in multiple
unit types, which does not happen very often. It is generally a mistake,
but we would prefer to let them make the mistake and then see an
irrational result and correcting it, rather then telling them they
probably made a mistake.

I think Scara's solution makes the most sense. It is slightly cleaner
then using an array and comes up with the same result.

Sim

pgsql-general by date:

Previous
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: 8.4.0 bug - failure to enforce a foreign key constraint
Next
From: Scara Maccai
Date:
Subject: Re: multiple paramters in aggregate function