Thread: strip nulls functions for json and jsonb
As discussed recently, here is an undocumented patch for json_strip_nulls and jsonb_strip_nulls. cheers andrew
Attachment
Hi
2014-10-04 1:23 GMT+02:00 Andrew Dunstan <andrew@dunslane.net>:
As discussed recently, here is an undocumented patch for json_strip_nulls and jsonb_strip_nulls.
It is looking well
Regards
Pavel
cheers
andrew
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello
I checked this patch. 1. There is a consensus we want this feature.
2. This patch implement just this mentioned feature. There is no objection against design.
3. It is possible to apply this patch and compile without warnings.6. code is well formatted
2014-10-04 1:23 GMT+02:00 Andrew Dunstan <andrew@dunslane.net>:
As discussed recently, here is an undocumented patch for json_strip_nulls and jsonb_strip_nulls.
cheers
andrew
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 10/16/2014 04:12 PM, Pavel Stehule wrote: > > > 1. missing documentation > > 2. I miss more comments related to this functions. This code is > relative simple, but some more explanation can be welcome. > > 3. why these functions are marked as "stable"? > > New patch: Docs added, functions marked immutable, more comments added. cheers andrew
Attachment
Hi
I have a question,what is expected result of null strip of
?
2014-10-26 19:59 GMT+01:00 Andrew Dunstan <andrew@dunslane.net>:
On 10/16/2014 04:12 PM, Pavel Stehule wrote:
1. missing documentation
2. I miss more comments related to this functions. This code is relative simple, but some more explanation can be welcome.
3. why these functions are marked as "stable"?
New patch:
Docs added, functions marked immutable, more comments added.
cheers
andrew
On 10/26/2014 03:50 PM, Pavel Stehule wrote: > Hi > > I have a question, > > what is expected result of null strip of > > {"a": {"b": null, "c", null"} } > > ? > Please remember not to top-post. The above is not legal json, so the answer would be an error. cheers andrew
On 26 October 2014 20:07, Andrew Dunstan <andrew@dunslane.net> wrote:
On 10/26/2014 03:50 PM, Pavel Stehule wrote:Hi
I have a question,
what is expected result of null strip of
{"a": {"b": null, "c", null"} }
?
Please remember not to top-post.
The above is not legal json, so the answer would be an error.
I believe Pavel means:
{"a": {"b": null, "c": null} }
Thom
2014-10-26 21:18 GMT+01:00 Andrew Dunstan <andrew@dunslane.net>:
On 10/26/2014 04:14 PM, Thom Brown wrote:On 26 October 2014 20:07, Andrew Dunstan <andrew@dunslane.net <mailto:andrew@dunslane.net>> wrote:
On 10/26/2014 03:50 PM, Pavel Stehule wrote:
Hi
I have a question,
what is expected result of null strip of
{"a": {"b": null, "c", null"} }
?
Please remember not to top-post.
The above is not legal json, so the answer would be an error.
I believe Pavel means:
{"a": {"b": null, "c": null} }
This is the expected result:
andrew=# select json_strip_nulls('{"a": {"b": null, "c": null} }');
json_strip_nulls
------------------
{"a":{}}
(1 row)
It is NOT expected that we replace an empty object with NULL (and then strip it if it's a field value of an outer level object).
ok,
This case should be in regress test probably
Thank you
Pavel
Pavel
cheers
andrew
On 10/26/2014 04:14 PM, Thom Brown wrote: > On 26 October 2014 20:07, Andrew Dunstan <andrew@dunslane.net > <mailto:andrew@dunslane.net>> wrote: > > > On 10/26/2014 03:50 PM, Pavel Stehule wrote: > > Hi > > I have a question, > > what is expected result of null strip of > > {"a": {"b": null, "c", null"} } > > ? > > > > Please remember not to top-post. > > The above is not legal json, so the answer would be an error. > > > I believe Pavel means: > > {"a": {"b": null, "c": null} } This is the expected result: andrew=# select json_strip_nulls('{"a": {"b": null, "c": null} }'); json_strip_nulls ------------------ {"a":{}} (1 row) It is NOT expected that we replace an empty object with NULL (and then strip it if it's a field value of an outer level object). cheers andrew
On 10/26/2014 04:22 PM, Pavel Stehule wrote: > > > 2014-10-26 21:18 GMT+01:00 Andrew Dunstan <andrew@dunslane.net > <mailto:andrew@dunslane.net>>: > > > On 10/26/2014 04:14 PM, Thom Brown wrote: > > On 26 October 2014 20:07, Andrew Dunstan <andrew@dunslane.net > <mailto:andrew@dunslane.net> <mailto:andrew@dunslane.net > <mailto:andrew@dunslane.net>>> wrote: > > > On 10/26/2014 03:50 PM, Pavel Stehule wrote: > > Hi > > I have a question, > > what is expected result of null strip of > > {"a": {"b": null, "c", null"} } > > ? > > > > Please remember not to top-post. > > The above is not legal json, so the answer would be an error. > > > I believe Pavel means: > > {"a": {"b": null, "c": null} } > > > This is the expected result: > > andrew=# select json_strip_nulls('{"a": {"b": null, "c": null} }'); > json_strip_nulls > ------------------ > {"a":{}} > (1 row) > > > It is NOT expected that we replace an empty object with NULL (and > then strip it if it's a field value of an outer level object). > > > ok, > > This case should be in regress test probably > > Patch attached. cheers andrew
Attachment
Hi
I am sending a final review of this patch:0. this patch implements null fields stripping. It does exactly what was proposed and we would to have this feature in core. It is requested feature for JSON types.
Pavel
2014-10-26 21:57 GMT+01:00 Andrew Dunstan <andrew@dunslane.net>:
On 10/26/2014 04:22 PM, Pavel Stehule wrote:
2014-10-26 21:18 GMT+01:00 Andrew Dunstan <andrew@dunslane.net <mailto:andrew@dunslane.net>>:
On 10/26/2014 04:14 PM, Thom Brown wrote:
On 26 October 2014 20:07, Andrew Dunstan <andrew@dunslane.net
<mailto:andrew@dunslane.net> <mailto:andrew@dunslane.net
<mailto:andrew@dunslane.net>>> wrote:
On 10/26/2014 03:50 PM, Pavel Stehule wrote:
Hi
I have a question,
what is expected result of null strip of
{"a": {"b": null, "c", null"} }
?
Please remember not to top-post.
The above is not legal json, so the answer would be an error.
I believe Pavel means:
{"a": {"b": null, "c": null} }
This is the expected result:
andrew=# select json_strip_nulls('{"a": {"b": null, "c": null} }');
json_strip_nulls
------------------
{"a":{}}
(1 row)
It is NOT expected that we replace an empty object with NULL (and
then strip it if it's a field value of an outer level object).
ok,
This case should be in regress test probably
Patch attached.
cheers
andrew