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

From Josh Berkus
Subject Re: mogrify and indent features for jsonb
Date
Msg-id 54ECCDF2.9000309@agliodbs.com
Whole thread Raw
In response to mogrify and indent features for jsonb  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: mogrify and indent features for jsonb  (Thom Brown <thom@linux.com>)
List pgsql-hackers
> Is there a way to take the json:
> 
> '{"a": 1, "b": 2, "c": {"type": "json", "stuff": "test"}, "d":
> ["aa","bb","cc","dd"]}'
> 
> and add "ee" to "d" without replacing it?  I can think of ways of
> currently doing it, but it's very convoluted just for pushing a value to
> an array.

Can you think of a reasonable syntax for doing that via operators?  I
can imagine that as a json_path function, i.e.:

jsonb_add_to_path(jsonb, text[], jsonb)

or where the end of the path is an array:

jsonb_add_to_path(jsonb, text[], text|int|float|bool)

But I simply can't imagine an operator syntax which would make it clear
what the user intended.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Combining Aggregates
Next
From: Peter Eisentraut
Date:
Subject: Re: Combining Aggregates