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

From Pavel Stehule
Subject Re: Re: proposal: ignore null fields in not relation type composite type based constructors
Date
Msg-id CAFj8pRCV_q+HTcQednVm6ctxa_tbw4U8+JwSRY-3N2BfbJmZ3A@mail.gmail.com
Whole thread Raw
In response to Re: Re: proposal: ignore null fields in not relation type composite type based constructors  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Responses Re: Re: proposal: ignore null fields in not relation type composite type based constructors
List pgsql-hackers
Hello


2014-08-22 12:21 GMT+02:00 Jeevan Chalke <jeevan.chalke@enterprisedb.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

pgsql-hackers by date:

Previous
From: Tomonari Katsumata
Date:
Subject: Re: proposal: rounding up time value less than its unit.
Next
From: Michael Paquier
Date:
Subject: Re: Support for N synchronous standby servers