PostgreSQL vs Oracle double

migrationoraclepostgresql

More of rant, than a question, but maybe someone would explain — why PostgreSQL migration wiki states that

FLOAT (Oracle) is REAL (Postgres) and DOUBLE is DOUBLE PRECISION

when in PostgreSQL DOUBLE PRECISION supports 15 significant digits, whereas in Oracle DOUBLE provides 38 ?!

IMO, this is quite an omission for people planning to migrate their data to PostgreSQL.

Best Answer

The information seems to be inaccurate.

Oracle has only three numeric data types:

  • NUMBER: binary coded decimals. Slow, but exact.

  • BINARY_FLOAT: IEEE single precision floating point number. Fast and quite imprecise.

  • BINARY_DOUBLE: IEEE double precision floating point number. Fast and less imprecise.

You can use INTEGER, DOUBLE PRECISION, REAL and FLOAT in Oracle, like the SQL standard demands, but you will always get a NUMBER (FLOAT is NUMBER, only the precision is given in binary rather than in decimal digits).


PostgreSQL has more numeric data types:

  • numeric (or decimal, which is just another name): binary coded decimals. Exact, but very slow.

    This corresponds to Oracle's NUMBER.

  • real (or float4): the platform's native single precision floating point numbers, usually IEEE

    This corresponds to Oracle's BINARY_FLOAT.

  • double precision (or float8): the platform's native double precision floating point numbers, usually IEEE

    This corresponds to Oracle's BINARY_DOUBLE.

  • integer (or int4): four-byte integers

    Oracle has nothing like that.

  • bigint (or int8): eight-byte integers

    Oracle has nothing like that.