Skip to content
  • There are no suggestions because the search field is empty.

Logging Non-Normalized (NaN) floating point values to PostgreSQL using the Cogent DataHub

When using the Cogent DataHub to log floating point and real values to a PostgreSQL Database, the following error is thrown whenever the value of the point being logged becomes Not-a-Number (NAN or QNAN):
ERROR: column 'nan' does not exist
Can the DataHub insert non-normalized floating point values to a PostgreSQL database?

In order to log non-normalized floating point values to a PostgreSQL database warp the value being inserted in single quotes i.e. 'nan' instead of nan. This will vary based on how the DataHub is used to insert the values:

When using the data logging feature in the DataHub user interface

Configure the transform(x) field to read string(x); to convert the real/floating point value to a string prior to inserting and wrap the value in single quotes. This will not cause any issues with inserting normal values to the database.

When using the scripting engine to handle data logging

Simply modify the INSERT statement that has been written to include the single quote characters around the value being inserted. Just as with the configuration through the UI, this will not negatively affect any 'normal' values being inserted.