Re: strip nulls functions for json and jsonb - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: strip nulls functions for json and jsonb
Date
Msg-id CAFj8pRBcPPvft94-D8azv9m1Nr35hyq41_+omYb9ngHzTJxMpg@mail.gmail.com
Whole thread Raw
In response to Re: strip nulls functions for json and jsonb  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
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.

1. there is no problem with patch apply and with compilation - one warning is fixed in attachments

2. code is relative small and clean, I have no any objection

3. there is necessary regress tests and related documentation.


I have no any objection - this patch is ready for commiter.

Thank you for patch

Regards

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

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: proposal: CREATE DATABASE vs. (partial) CHECKPOINT
Next
From: Ali Akbar
Date:
Subject: Re: Function array_agg(array)