Re: additional json functionality

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: additional json functionality
Date: 2013-11-14 15:42:49
Message-ID: 5284EF79.2030104@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/14/2013 01:42 AM, Andrew Dunstan wrote:
>
> On 11/13/2013 07:01 PM, Hannu Krosing wrote:
>>
>> I guess we should not replace current JSON type with hstore based
>> one, but add something json-like based on nested hstore instead.
>
>
> Well, that's two voices for that course of action.
I am not really "for" it (I would have liked to have a
json_object/json_structure instead of
json_string as the meaning of "json") but I think there is quite strong
argument
for not breaking backwards compatibility.
>
> Interesting that I don't think I heard a single voice for this either
> at pgCon or pgOpen,
I attended neither, but I did voice my preferences for _not_ having the
"json-as-source-code"
type on the mailing lists during previous json discussions.

> although I spent large amounts of time at both talking to people about
> Json, so I'd be interested to hear more voices.
>
> It would actually simplify things in a way if we do that - we've been
> working on
> a way of doing this that wouldn't upset pg_upgrade. This would render
> that effort unnecessary.
I wonder how hard it would be to rename current json to json_source and
have a new
nested-hstore based json ?

>
> However it will complicate things for users who will have to choose
> between the data types,
> and function authors who will possibly have to write versions of
> functions to work with both types.
You mostly want the functions for json-object type.

This is supported by the fact that current functions on json-source
treat it as json-object (for example key lookup gives you the value
of latest key and not a list of all matching key values).

You may want some new functions on json-source
(maybe json_source_enumerate_key_values(json, key))
but the current ones are really for json-object.

--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2013-11-14 15:46:56 Re: additional json functionality
Previous Message Tom Lane 2013-11-14 15:15:05 Re: Somebody broke \d on indexes