Thread: DECIMAL or NUMERIC Data Types

DECIMAL or NUMERIC Data Types

From
Carlos Mennens
Date:
Does it matter when writing SQL code in PostgreSQL if I use DECIMAL or
NUMERIC date types for a column named 'price' assuming it's to store
the associated items actual dollar amount?

Reading the fine manual*, I can't find a single difference between
either and they both are supported / recognized by PostgreSQL:

-decimal     variable     user-specified precision, exact     up to 131072
digits before the decimal point; up to 16383 digits after the decimal
point
-numeric     variable     user-specified precision, exact     up to 131072
digits before the decimal point; up to 16383 digits after the decimal
point

CREATE TABLE computers
(
id serial primary key,
make varchar(50) not null,
model varchar(50) not null,
owner varchar(50) not null
price decimal(7,2) not null,
warranty date not null
);

*Source = http://www.postgresql.org/docs/9.1/static/datatype-numeric.html


Re: DECIMAL or NUMERIC Data Types

From
Tom Lane
Date:
Carlos Mennens <carlos.mennens@gmail.com> writes:
> Does it matter when writing SQL code in PostgreSQL if I use DECIMAL or
> NUMERIC date types for a column named 'price' assuming it's to store
> the associated items actual dollar amount?

No, because they're the same type in Postgres, as you were already told
last week:
http://archives.postgresql.org/pgsql-general/2011-12/msg00899.php
        regards, tom lane