Skip to content

text into int giving NaN = non JSON #316

Open

Description

@mathiasrw

When I run

create table abc (a int); 
insert into abc values ("kjh");
select * from abc

I get [ 1, 1, [ { a: NaN } ] ]

I must admit that I expected to get [ 1, 0, [ ] ]

Could you put some words to how it converts when I put wrong data into my table? Then Ill put it in the wiki.

The output is a problem for alacon as NaN is not part of the JSON standart and therefore its output cant be parsed with JSON.decode() (I assume one would expect the output from alacon to be JSON)

Activity

  1. mathiasrw commented on Jun 23, 2015

    @mathiasrw
    MemberAuthor

    I put the bug lable on it as I consider it a bug that alacon can output non JSON data.

  2. mathiasrw commented on Jun 27, 2015

    @mathiasrw
    MemberAuthor

    I met the same issue with infinity

    alacon "SELECT MATRIX 1/0"
    [ [ Infinity ] ]
    

    I would expect null

  3. mathiasrw commented on Jul 28, 2015

    @mathiasrw
    MemberAuthor

    For alacon we might want to use output with JSON.stringify together with a replacer for values as

    NaN
    Infinity
    -Infinity
    Object
    

    See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

    I have a feeling the best solution would be to replace with a null - please note that the original comment in this issue is about what data gets into the data (that one cant put string into int) while this comment is about getting data out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions