Re: Output of query_to_xml

From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: "P(dot) Broennimann" <peter(dot)broennimann(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Output of query_to_xml
Date: 2012-06-21 11:40:11
Message-ID: CAHHcreqSb=rx9pKCfc5vKL1eD4PU7-3_qEcfiANT4p_2=aSTjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2012/6/21 P. Broennimann <peter(dot)broennimann(at)gmail(dot)com>:
> Hi there
>
> In my stored function I use:
>
> select query_to_xml('select * from table12', true, true, '') into ...
>
>
> The result is OK but there is always an empty line:
>
> <row xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>                                 <-- Empty line here
>  <vanoao>FG8976SDFRETG</vanoao>
>  <country_code>NL</country_code>
>  <build_date>2011-02-28</build_date>
>  <tcode>MFT</tcode>
>  <exterior_color_code>GAB</exterior_color_code>
>  <interior_color_code>TAFP</interior_color_code>
> </row>
>
> Is this supposed to be or is this a cosmetic bug?

In fact this is in code [1], obviously, but if it should be there I don't know.

That extra line only is printed when 'tableforest' is set to true, so
if you use:

select query_to_xml('select * from table12', true, false, '')

the extra line and the 'xmlns:xsi=' for <row> tag goes always.

[1] http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/xml.c;h=44d327d7606df620c01b6e6532e53a9ee7a21f23;hb=HEAD#l2386

regards
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://guedesoft.net - http://www.postgresql.org.br

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniele Varrazzo 2012-06-21 12:12:58 Reading storage parameters
Previous Message Marc Watson 2012-06-21 11:37:57 Re: 32-bit libpq with 64-bit server