what is the difference between decimal data type and numeric datatype in postgresql ? I do not find any difference in manual.
There is no difference in PostgreSQL. Per documentation:
The types
decimal
andnumeric
are equivalent. Both types are part of the SQL standard.
Quoted from: https://www.postgresql.org/message-id/[email protected]
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With