proposal: ignore null fields in not relation type composite type based constructors

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: proposal: ignore null fields in not relation type composite type based constructors
Date: 2014-05-25 05:53:15
Message-ID: CAFj8pRA1KZt8v8Eo9r9zED25w3cfMm8n-_5+cySpPs0Xz-bYrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2014-05-25 07:17:24 pg9.4b1: unhelpful error message when creating a collation
Previous Message Tomas Vondra 2014-05-24 23:02:25 Re: Sending out a request for more buildfarm animals?