Why do FLOAT4 and FLOAT8 values in PostgreSQL show additional decimal places when loaded to BigQuery?
This behavior is due to differences in how PostgreSQL and BigQuery handle floating-point precision.
BigQuery supports only the FLOAT64 floating-point data type. To ensure compatibility, Hevo converts PostgreSQL floating-point types (FLOAT4 and FLOAT8) to FLOAT64 when loading data to the Destination. This conversion increases the value’s precision and can introduce additional decimal places that were not present in the PostgreSQL data. However, the numeric value remains accurate and is not changed during the conversion. For example, a value stored as 3.333 in PostgreSQL might appear as 3.3329999446868896 in BigQuery, which is mathematically equivalent to the original value.
To maintain consistent decimal precision between your Source and Destination data, you can do one of the following:
-
Convert the PostgreSQL floating-point columns to fixed-point data types such as NUMERIC or DECIMAL to ensure exact precision.
-
Use Models to round the values to a desired number of decimal places in your Destination.