-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve support for int arrays and float arrays #501
Conversation
javascript numbers are 64-bit floating numbers
Cool! Thanks! This actually changes the return type from big integers from their old, incorrect type of JavaScript ints into a new, correct type of JavaScript strings, right? Since int64 can technically overflow? I wanna make sure I bump the major version if it is indeed a non-backwards compatible change. I think there are a few more weirdnesses in #452 I'll try to address as well before I bump the major version component. |
Yes that is what it does. I agree too, it's a breaking change requiring a bump in the major. Just some more details: If a user has been selecting int8 values within the number range that javascript supports they wouldn't have been experiencing any problems. Shifting parsing int8s over to strings as the default makes sense, but would be a breaking change for anyone selecting int8 values and working with them as numbers in their code. Currently we parse int8 datatypes as javascript numbers. int8 can go up to (2^63)-1 (9223372036854775807) but javascript's numbers can only go up to 2^53 (9007199254740992) without issues. Any int8 value above what javascript supports may not be the correct value due to an overflow. References |
Just as a note to myself - maybe I'll try to get a patch for this in before bumping the major version too? |
@lalitkapoor thanks for this so much! 👍 sorry it took so long for me to merge it - needed to have some time & the mental fortitude to commit to doing a little refactoring in prep for pg@3.x. ❤️ |
improve support for int arrays and float arrays
Hello, What's the recommended way to handle bigint postgres type? Right now pg.defaults.parseInt8 is inconsistent:
When pg.defaults.parseInt8 = true:
Looks like both should be strings by default, and both should be numbers when |
addresses #452