postgresqlsqldatatypes

What is the PostgreSQL Equivalent of Oracle's FLOAT(126)?


I need to migrate some data from Oracle to Postgres. I am not finding an exact equivalent to Oracles FLOAT(126) (126 binary digits). Postgres has a max of FLOAT(54) (54 binary digits).

What is the equivalent of Oracle's FLOAT(126) in PostgreSQL?


Solution

  • In Oracle version 11 (give or take) and previous versions, the Oracle data type of FLOAT has a parameter of p (precision) and then later uses the term 'binary digits' for the same parameter. Oracle needs to use the term 'Mantissa Significant Bits' in their old documentation and replace both of these terms in the FLOAT data type definition! This is based on the IEEE Standard 754 for floating point numbers.

    FLOAT(126) is equivalent to NUMBER(38)

    NUMBER decimal digits (precision) = 126 Mantissa bits for FLOAT / LOG(2,10)

    Just use NUMBER in Oracle and NUMERIC in Postgres.

    To answer your question, use NUMERIC(38) for Postgres.


    In later versions, FLOAT is equivalent to NUMBER, so the Postgres parameter is identical as well. In later versions, ORACLE BINARY_FLOAT is backwards compatible with the previous version of FLOAT (from the conversion above) using IEEE Standard 754.