8

what is the difference between decimal data type and numeric datatype in postgresql ? I do not find any difference in manual.

App Work
  • 21,899
  • 5
  • 25
  • 38
  • 1
    You can follow the links given below: http://stackoverflow.com/questions/1841915/difference-betweeen-decimal-and-numeric – jyotiprakash Feb 27 '12 at 11:12

2 Answers2

4

There is no difference in PostgreSQL. Per documentation:

The types decimal and numeric are equivalent. Both types are part of the SQL standard.

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228
2

Quoted from: https://www.postgresql.org/message-id/20211.1325269672@sss.pgh.pa.us

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
geoyws
  • 3,326
  • 3
  • 35
  • 47