Giter Site home page Giter Site logo

Comments (6)

TheInnerLight avatar TheInnerLight commented on April 28, 2024 2

While it's theoretically possible to modify the Hasura console such that large numbers are propagated unchanged, doing so would not eliminate surprising behaviour because any producer or consumer of the JSON would be entitled to truncate numeric JSON columns.

The recommendation in RFC 8259 on good interoperability is to expect no more precision or range than double precision IEEE754.

For wide numeric types at database column level, Hasura provides the stringify-numeric-types option. Of course, this option does not exist within JSONB columns because Hasura has no way to infer a schema from arbitrary JSON.

We would recommend that you change the format of your provided JSON to use a string representation of the large number. This will ensure that your representation of numeric data will be properly portable, respected by all potential producers and consumers.

from graphql-engine.

bjartek avatar bjartek commented on April 28, 2024

Hey I am OP here thanks for filing.

I have used golang/pgx to insert my data. In golang this field was a uint64.

from graphql-engine.

soupi avatar soupi commented on April 28, 2024

Hey folks, thanks for reporting. The underlying issue here is that most json implementations implement numbers as IEE-754, and as such big integers that go beyond the supported range can be truncated at various occasions, such as browsers parsing json:

Screencast.from.2024-02-14.16-54-16.webm

Specifically what's going on here is that the browser encodes and decodes these big int values outside of graphql engine.

from graphql-engine.

bjartek avatar bjartek commented on April 28, 2024

So what are issues that can be used to solve this? Would it be possible to have an option in engine to transform jsonb so that numbers are converted as strings?

from graphql-engine.

bjartek avatar bjartek commented on April 28, 2024

Would it be possible to have this fixed in cloud.hasura graphiql?

from graphql-engine.

jmbeekman avatar jmbeekman commented on April 28, 2024

I got such mixed results with my experiments. Manual insertion via Dbeaver worked fine, insertion via a mutation worked fine, it was only when I used the data tab to insert the row that this happened. @bjartek is using a data structure that should be able to handle that many digits, but something, somewhere is getting lost in the sauce.

from graphql-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.