Re: multiple paramters in aggregate function

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple paramters in aggregate function
Date: 2009-08-13 12:50:51
Message-ID: 4A840C2B.6090309@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mito 2009-08-13 13:02:14 Selecting rows by content of array type field
Previous Message Grzegorz Jaśkiewicz 2009-08-13 12:23:00 Re: 8.4.0 bug - failure to enforce a foreign key constraint