Inserting NaN value to a PostgrSQL database requires apostrophes around it. QPSQL doesn't add those and the insertion fails with
QSqlError("42703", "QPSQL: Unable to create query", "ERROR: column "nan" does not exist
LINE 1: EXECUTE qpsqlpstmt_1 (nan)
This problem has been fixed for double type in https://bugreports.qt.io/browse/QTBUG-3088. Equal check in QPSQLDriver::formatValue() for float type would do the trick, which leads to another minor "problem" that QSqlField.type is QVariant::Type, which doesn't have the float type.
Tested with following code snippet: