NUMERIC data types

Informix® supports several data types to store numbers:

Table 1. Informix numeric data types
Informix data type Description
SMALLINT 16 bit signed integer
INT / INTEGER 32 bit signed integer
BIGINT 64 bit signed integer
INT8 64 bit signed integer (replaced by BIGINT)
DEC / DECIMAL Equivalent to DECIMAL(16)
DEC / DECIMAL(p) Floating-point decimal number
DEC / DECIMAL(p,s) Fixed-point decimal number
MONEY Equivalent to DECIMAL(16,2)
MONEY(p) Equivalent to DECIMAL(p,2)
MONEY(p,s) Equivalent to DECIMAL(p,s)
REAL / SMALLFLOAT 32-bit floating point decimal (C float)
DOUBLE PRECISION / FLOAT[(n)] 64-bit floating point decimal (C double)

Solution

PostgreSQL supports the following data types to store numbers:

Table 2. PostgreSQL numeric data types
PostgreSQL data type Description
NUMERIC(p,s) / DECIMAL(p,s) Decimals with precision and scale (fractional part)
NUMERIC(p) / DECIMAL(p) Integers with p digits (no fractional part)
NUMERIC / DECIMAL Floating point numbers (no limit)
FLOAT4 16 bit variable precision
FLOAT8 32 bit variable precision
INT2 16 bit signed integer
INT4 32 bit signed integer
INT8/BIGINT 64 bit signed integer

ANSI types like SMALLINT, INTEGER, FLOAT are supported by PostgreSQL as aliases to INT2, INT4 and FLOAT8 native types.

Informix DECIMAL(p) floating point types are converted to DECIMAL without precision/scale, to store any floating point number in PostgreSQL.