Re: Money casting too liberal?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Cc: Gavan Schneider <pg-gts(at)snkmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Money casting too liberal?
Date: 2013-03-30 00:23:50
Message-ID: 1364603030.1187.220.camel@sussancws0025
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2013-03-29 at 16:30 -0400, D'Arcy J.M. Cain wrote:
> How would this be an issue? If you are assigning a literal to a column
> then that's no issue. Otherwise, a literal is simply a value that can
> be cast depending on the situation. The money type is no different in
> that regard.
>
> As a result of an expression, it will have the type of the data in the
> expression. What if the result is the addition of two columns of
> different precisions? Pick the higher precision? Forbid the
> operation? The latter may make sense. How can you add Yen and US$?

Why not have various rounding functions that do exactly what you want?
Then you can use them anywhere you want in an expression.

Tying a bunch of magic to the column, I/O function, or type system just
seems like the wrong approach when it comes to real differences (like
precision).

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gavan Schneider 2013-03-30 01:04:21 Re: Money casting too liberal?
Previous Message Tom Lane 2013-03-29 23:30:52 Re: unique indices without pg_constraint rows