Re: Data Type for Money

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Data Type for Money
Date: 2011-12-30 18:27:52
Message-ID: 20211.1325269672@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> writes:
> Thanks. I just for some reason can't see or understand the difference
> between 'decimal' & 'numeric'. Why have two data types for the same
> values? Am I missing something?

There isn't any difference, in Postgres. There are two type names
because the SQL standard requires us to accept both names. In a quick
look in the standard it appears that the only difference is this:

17)NUMERIC specifies the data type exact numeric, with the decimal
precision and scale specified by the <precision> and <scale>.

18)DECIMAL specifies the data type exact numeric, with the decimal
scale specified by the <scale> and the implementation-defined
decimal precision equal to or greater than the value of the
specified <precision>.

ie, for DECIMAL the implementation is allowed to allow more digits than
requested to the left of the decimal point. Postgres doesn't exercise
that freedom so there's no difference between these types for us.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2011-12-30 18:34:16 Re: Verifying a timestamp is null or in the past
Previous Message Carlos Mennens 2011-12-30 18:10:13 Re: Data Type for Money