Re: Money casting too liberal?

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

On Fri, 29 Mar 2013 12:02:49 -0700
Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Thu, 2013-03-28 at 23:43 +1100, Gavan Schneider wrote:
> > If the money type is meant to be serious then these
> > conventions need to be followed/settable on a column by column
> > basis.
>
> I don't like the idea of tying the semantics to a column. That leaves
> out values that aren't stored in a column, e.g. literals or the
> results of some expression.

OK, I hadn't though of that but now that I am..

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$?

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner.
IM: darcy(at)Vex(dot)Net, VOIP: sip:darcy(at)Vex(dot)Net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gavan Schneider 2013-03-29 22:30:34 Re: Money casting too liberal?
Previous Message Misa Simic 2013-03-29 20:21:54 Re: Is there any way to listen to NOTIFY in php without polling?