Re: [PATCH] Generalized JSON output functions

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ryan Pedela <rpedela(at)datalanche(dot)com>
Cc: "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, 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>, Andrew Dunstan <andrew(at)dunslane(dot)net>, hlinnaka <hlinnaka(at)iki(dot)fi>
Subject: Re: [PATCH] Generalized JSON output functions
Date: 2015-07-15 14:52:29
Message-ID: CA+Tgmoa+hK-boB9FzxYNW0S-2LJpb_9mp_M_6DU8QXyVLVFeWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 13, 2015 at 10:46 AM, Ryan Pedela <rpedela(at)datalanche(dot)com> wrote:
> 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.

FWIW, I don't agree. If it's not easy to read the JSON that
PostgreSQL generates using JavaScript, then a lot of people are just
going to give up on doing it, and IMO that would be sad. Telling
people that they have to parse the JSON using some parser other than
the one built into their JavaScript engine, whack it around, and then
render it as text and parse it again is not really an acceptable
answer. The reason why the logical decoding stuff allows multiple
output formats is because Andres, quite correctly, foresaw that
different people would need different output formats. He could have
designed that system to output only one output format and just said,
everybody's got to read and parse this, but that would have been slow.
Instead, he tried to set things up so that you could get the output in
the format that was most convenient for your client, whatever that is.
On this thread, we're back-pedaling from that idea: sorry, you can get
JSON output, but if you want JSON output that will be properly
interpreted by your JSON parser, you can't have that. Regardless of
the details of this particular patch, I can't endorse that approach.
If we want people to use our software, we need to meet them where they
are at, especially when we are only (IIUC) talking about inserting a
few extra quotation marks.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-07-15 14:52:49 Re: Implementation of global temporary tables?
Previous Message Pavel Stehule 2015-07-15 14:24:26 Re: Implementation of global temporary tables?