Re: [pgAdmin4][RM3587] Browser rendering of a bigint in a jsonb is wrong

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][RM3587] Browser rendering of a bigint in a jsonb is wrong
Date: 2019-02-26 14:34:06
Message-ID: CA+OCxoxWkhECXSTDsvmeKDrmOoK3QJhB8TSqeH4kB5jHMaxMsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

On Tue, Feb 26, 2019 at 8:55 AM Aditya Toshniwal <
aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:

> Hi Hackers,
>
> Attached is the patch to fix incorrect rendering of bigint in jsonb.
> The problem is in javascript limitations with big numbers. For fixing,
> jsonb data will be fetched as string now, similar to json, so that JS will
> not consider big numbers as number. The only drawback here is that, the
> popup editor will not show formatted json, as that requires JSON.parse
> which will change the big numbers.
>
> Kindly review.
>
> Below is sample data for testing:
> CREATE TABLE public.tab_jsonbigint
> (
> id integer NOT NULL PRIMARY KEY,
> coljsonb jsonb
> )
>
> insert into tab_jsonbigint(id, coljsonb) values(3,'[{"a":
> 83136002445762248}, {"a": 831360024457622448}]');
>
> select d.*, t.coljsonb from tab_jsonbigint t,
> jsonb_to_recordset(t.coljsonb) as d("a" bigint);
>

Hmm, that's unfortunate.

What about using json-bignumber?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Aditya Toshniwal 2019-02-27 04:42:14 Re: [pgAdmin4][RM3587] Browser rendering of a bigint in a jsonb is wrong
Previous Message Dave Page 2019-02-26 13:47:06 Re: [pgAdmin4][RM4034] Auto resize column when double clicked on column resizer is SQL data output grid