From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Ryan Pedela <rpedela(at)datalanche(dot)com>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, hlinnaka(at)iki(dot)fi, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: [PATCH] Generalized JSON output functions |
Date: | 2015-07-13 14:59:41 |
Message-ID: | 55A3D25D.8010100@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 07/13/2015 10:46 AM, Ryan Pedela wrote:
> On Mon, Jul 13, 2015 at 1:30 AM, Shulgin, Oleksandr
> <oleksandr(dot)shulgin(at)zalando(dot)de <mailto:oleksandr(dot)shulgin(at)zalando(dot)de>>
> wrote:
>
>
> To reiterate: for my problem, that is escaping numerics that can
> potentially overflow[1] under ECMAScript standard, I want to be
> able to override the code that outputs the numeric converted to
> string. There is no way in current implementation to do that *at
> all*, short of copying all the code involved in producing JSON
> output and changing it at certain points. One could try
> re-parsing JSON instead, but that doesn't actually solve the
> issue, because type information is lost forever at that point.
>
>
> I had the exact same problem with Node.js and client-side Javascript.
> That is why I wrote json-bignum [1] for Node.js. There is a bower
> version [2] as well. The only caveat is that it is slower than the
> native JSON functions, but I am happy to receive PRs to improve
> performance.
>
> 1. https://github.com/datalanche/json-bignum
> 2. https://libraries.io/bower/json-bignum
>
> As far as large numbers in JSON, I think Postgres is doing the right
> thing and should not be changed. It is Javascript that is stupid here,
> and I don't think it is wise to add something to core just because one
> client does stupid things with large numbers. In addition, ES7 is
> introducing "value types" which will hopefully solve the large number
> problem in Javascript.
>
> The random whitespace issue is valid in my opinion and should be fixed.
>
>
>
OK, I think we're getting a consensus here. It's good to know the JS
world is acquiring some sanity in this area.
Let's just fix the whitespace and be done, without all the callback
stuff. That should be a much smaller patch.
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2015-07-13 15:05:00 | Re: Freeze avoidance of very large table. |
Previous Message | Andrew Dunstan | 2015-07-13 14:51:28 | Re: [PATCH] Generalized JSON output functions |