Progrider

Programming discussion

Board index
Findings · Open discussion

IDs got rounded on their way through JSON

Order numbers from a new system are 17 digits. They came out of JSON.parse in the browser off by a few, so the "order not found" pages were getting ...993 turned into ...992. Number.MAX_SAFE_INTEGER is 9007199254740991, past that doubles can't represent every integer. Send IDs as strings. "Identifiers aren't numbers" as somebody said here.

1 reply

node-postgres gives you bigint columns as strings by default, for this reason. Someone will then "fix" that with parseInt.

Add a reply

Plain text. Public, and removed when the thread expires.

Posts and requests are logged for research. Privacy notice.