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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Re: proposal: ignore null fields in not relation type composite type based constructors
Date: 2014-08-23 05:21:50
Message-ID: CAFj8pRCV_q+HTcQednVm6ctxa_tbw4U8+JwSRY-3N2BfbJmZ3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2014-08-22 12:21 GMT+02:00 Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>:

> Hi Pavel,
>
> You have said that XMLFOREST has something which ignores nulls, what's
> that?
> Will you please provide an example ?
>

I was partially wrong - XMLFOREST ignore null always

postgres=# select xmlforest(10 as a,20 as b,null as c);
xmlforest
--------------------
<a>10</a><b>20</b>
(1 row)

so if you would to empty elements, you should to use xmlelement and
xmlconcat

postgres=# select xmlconcat(xmlforest(10 as a,20 as b), xmlelement(name c,
null));
xmlconcat
------------------------
<a>10</a><b>20</b><c/>
(1 row)

>
> I am NOT sure, but here you are trying to omit entire field from the output
> when its value is NULL. But that will add an extra efforts at other end
> which is using output of this. That application need to know all fields and
> then need to replace NULL values for missing fields. However we have an
> optional argument for ignoring nulls and thus we are safe. Application will
> use as per its choice.
>

with my patch, you can do decision - lot of REST services doesn't
distinguishes between empty and missing tag - and some developers prefer
remove empty tags due less size of message.

>
> Well, apart from that, tried reviewing the patch. Patch was applied but
> make
> failed with following error.
>
> make[3]: Entering directory `/home/jeevan/pg_master/src/backend/catalog'
> cd ../../../src/include/catalog && '/usr/bin/perl' ./duplicate_oids
> 3255
> make[3]: *** [postgres.bki] Error 1
>
> Please run unused_oids script to find unused oid.
>

it needs remastering

update in attachemnt

>
> However, I had a quick look over code changes. At first glance it looks
> good. But still need to check on SQL level and then code walk-through.
>
> Waiting for updated patch.
>

thank you for review

Regards

Pavel

>
> Thanks
>
> --
> Jeevan B Chalke
> Principal Software Engineer, Product Development
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
>
>

Attachment Content-Type Size
row_to_json_choosy-2.patch text/x-patch 7.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-08-23 05:52:23 Re: Support for N synchronous standby servers
Previous Message Tomonari Katsumata 2014-08-23 04:14:06 Re: proposal: rounding up time value less than its unit.