mogrify and indent features for jsonb - Mailing list pgsql-hackers

From Andrew Dunstan
Subject mogrify and indent features for jsonb
Date
Msg-id 54E00D1F.9060101@dunslane.net
Whole thread Raw
Responses Re: mogrify and indent features for jsonb  (Sehrope Sarkuni <sehrope@jackdb.com>)
Re: mogrify and indent features for jsonb  (Andrew Dunstan <andrew@dunslane.net>)
Re: mogrify and indent features for jsonb  (Thom Brown <thom@linux.com>)
Re: mogrify and indent features for jsonb  (Eva7 <billnoboyd@gmail.com>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Auditing extension for PostgreSQL (Take 2)
Next
From: Peter Eisentraut
Date:
Subject: Add pg_settings.pending_restart column