Re: mogrify and indent features for jsonb

From: Ilya Ashchepkov <koctep(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: mogrify and indent features for jsonb
Date: 2015-03-11 08:05:00
Message-ID: 20150311140500.346061dd@moni.nskavd.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 14 Feb 2015 22:06:07 -0500
Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

Hello.

I have function with recursive merging objects:

# SELECT jsonb_deep_extend('{"a": {"b": 6}}'::jsonb, '{"a": {"c":
7}}'::jsonb) AS new_jsonb;
new_jsonb
-------------------------
{"a": {"b": 6, "c": 7}}

https://github.com/koctep/jsonb-extend

I think this function may be useful for people too.

Could you add it to your patch? I don't have enough time to prepare
patch.

>
> Attached is a patch to provide a number of very useful facilities to
> jsonb that people have asked for. These are based on work by Dmitry
> Dolgov in his jsonbx extension, but I take responsibility for any
> bugs.
>
> The facilities are:
>
> new operations:
>
> concatenation: jsonb || jsonb -> jsonb
> deletion: jsonb - text -> jsonb
> deletion: jsonb - int -> text
>
> new functions:
>
> produce indented text: jsonb_indent(jsonb) -> text
> change an element at a path: jsonb_replace(jsonb, text[], jsonb) ->
> jsonb.
>
>
> It would be relatively trivial to add:
>
> delete an element at a path: jsonb_delete(jsonb, text[]) -> json
>
> and I think we should do that for the sake of completeness.
>
> The docs might need a little extra work, and the indent code
> definitely needs work, which I hope to complete in the next day or
> two, but I wanted to put a stake in the ground.
>
>
> cheers
>
> andrew
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2015-03-11 08:37:55 Re: EvalPlanQual behaves oddly for FDW queries involving system columns
Previous Message Michael Paquier 2015-03-11 07:01:04 Re: [REVIEW] Re: Compression of full-page-writes