proposal: ignore null fields in not relation type composite type based constructors - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal: ignore null fields in not relation type composite type based constructors
Date
Msg-id CAFj8pRA1KZt8v8Eo9r9zED25w3cfMm8n-_5+cySpPs0Xz-bYrQ@mail.gmail.com
Whole thread Raw
Responses Re: proposal: ignore null fields in not relation type composite type based constructors
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Sending out a request for more buildfarm animals?
Next
From: Fabien COELHO
Date:
Subject: pg9.4b1: unhelpful error message when creating a collation