Re: additional json functionality

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, 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 16:54:54
Message-ID: 5285005E.5060608@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/14/2013 05:06 PM, Merlin Moncure wrote:
> On Thu, Nov 14, 2013 at 9:42 AM, Hannu Krosing <hannu(at)2ndquadrant(dot)com> wrote:
>> 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).
> yeah. hm. that's a good point.
>
> Maybe there's a middle ground here: I bet the compatibility issues
> would be minimized to an acceptable level if the 'xxx_to_json'
> functions maintained their current behaviors; they would construct the
> json type in a special internal mode that would behave like the
> current type does.
Do you have any xxx_to_json usage which can generate a field with
multiple equal keys ?

Or is it just about preserving order ?
> In other words, the marshalling into binary
> structure could happen when:
>
> *) stored do a column in a table
> *) when any modifying routine is called, updating a key, value, etc
> *) manually via a function
>
> but not at cast time. This preserves compatibility for the important
> points and allows serialization of structures that are difficult with
> the binary mode variant.
Seems like this would not play nice with how PostgreSQL type system work
in general, but could be a way forward if you say that you really do not
need
to store the order-preserving, multi-valued json.

But in this case it could also be possible for these function to just
generate
json-format "text", and with proper casts this would act exactly as you
describe
above, no ?

--
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 Tom Lane 2013-11-14 17:01:52 Re: Ideas of "printing out" the alternative paths
Previous Message Hannu Krosing 2013-11-14 16:50:02 Re: nested hstore patch