| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
| Subject: | Re: proposal: ignore null fields in not relation type composite type based constructors |
| Date: | 2014-06-28 15:42:58 |
| Message-ID: | CAFj8pRCizZwv2yFMCQs6bVGofaELPY7tQx4sZs_WT1FVwj+Q3A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello
I am sending small patch, that allows ignore nulls in row_to_json function.
It allow significant size reduction of generated JSON documents.
Regards
Pavel
2014-05-25 7:53 GMT+02:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> Hello
>
> In Czech Postgres mailing list was user request for serialization to json
> without null values.
>
> He needs a similar behave like XMLFOREST has - it ignores NULLs
>
> In some situations and conversions, when your table is +/- sparse matrix,
> this request is valid
>
> postgres=# select hstore(omega) from omega;
> hstore
> ─────────────────────────────────
> "a"=>"10", "b"=>"20", "c"=>NULL
> "a"=>NULL, "b"=>"20", "c"=>"30"
> (2 rows)
>
> Proposed function
>
> postgres=# select hstore(omega, ignore_nulls := true) from omega;
> hstore
> ─────────────────────────────────
> "a"=>"10", "b"=>"20"
> "b"=>"20", "c"=>"30"
> (2 rows)
>
> What do you thinking about this proposal?
>
> Regards
>
> Pavel
>
>
| Attachment | Content-Type | Size |
|---|---|---|
| row_to_json_choosy.patch | text/x-patch | 7.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2014-06-28 16:36:39 | Re: better atomics - v0.5 |
| Previous Message | Kevin Grittner | 2014-06-28 14:35:10 | Re: delta relations in AFTER triggers |