Thread: Output of query_to_xml
Hi there
In my stored function I use:
The result is OK but there is always an empty line:
Is this supposed to be or is this a cosmetic bug?
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?
Thanks,
P.
P.
2012/6/21 P. Broennimann <peter.broennimann@gmail.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@guedesoft.net - skype: guediz http://guedesoft.net - http://www.postgresql.org.br
On tor, 2012-06-21 at 07:49 +0200, P. Broennimann wrote: > 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? No reason. I think it just came out this way because there are so many modes to handle, and you want some legible output in all of them. I've removed outputting the extra newline in 9.3devel.