I'm using a jsonb
column, where the JSON documents contain large integers (PostgreSQL 9.5). I've noticed that when the value stored has too many significant digits, it gets truncated.
As an example, I insert this into my table:
{"value": 7598786232076607106}
And when I select back the same row, I get:
{"value": 7598786232076607000}
According to the documentation, numeric fields in jsonb are stored using the standard numeric
type from postgres, and numeric
normally allows:
up to 131072 digits before the decimal point; up to 16383 digits after the decimal point
Is it possible to actually get this behavior with jsonb
, instead of truncation?
numeric
isn'tjsonb
. In jsonb you're just storing structured text, not binary or decimal numbers. Can you show the query that produces this so we can see the actual origin of the issue? – Craig Ringer May 1 '17 at 1:43jsonb
column. Basically, I insert:{"value": 7598786232076607106}
, and when I select back, I get{"value": 7598786232076607000}
. The documentation says numeric values injsonb
are using the standardnumeric
type from postgres. – Flavien May 1 '17 at 10:17