mountetna / magma

Data server with friendly data loaders
GNU General Public License v2.0
5 stars 2 forks source link

Floats can be NaN #188

Open graft opened 3 years ago

graft commented 3 years ago

Postgres supports a NaN value for float columns, and somehow Magma allows NaN to be set in the database. When we subsequently query for the record, Magma faithfully turns postgres NaN into Ruby NaN and tries to send it as JSON, but then complains that NaN is not valid JSON.

We may remediate by:

1) Providing NaN support (probably through requiring parsing the JSON value "NaN" on the client side) - this might be onerous for clients, especially those who wish to do math on a nice matrix.

2) Refuse to set NaN values. It's not exactly clear how NaN is being set, but since eventually everything must go through Magma::Loader now to get set, it shouldn't be hard to gatekeep this.

Of the two (1) is probably the more interesting because we might use NaN not to mean "NaN", but to provide blank support, which ought to exist for floats as anything else.