Skip to content

Floats can be NaN #188

@graft

Description

@graft

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions