Re: xmlserialize bug - extra empty row at the end
От
Jim Jones
Тема
Re: xmlserialize bug - extra empty row at the end
Дата
Msg-id
79b7c5b9-f033-dd16-3917-d0b2dc6b0d2b@uni-muenster.de
Ответ на
Список
Дерево обсуждения
xmlserialize bug - extra empty row at the end Pavel Stehule <pavel.stehule@gmail.com>
Re: xmlserialize bug - extra empty row at the end Jim Jones <jim.jones@uni-muenster.de>
Re: xmlserialize bug - extra empty row at the end Dmitry Dolgov <9erthalion6@gmail.com>
Re: xmlserialize bug - extra empty row at the end Tom Lane <tgl@sss.pgh.pa.us>
Re: xmlserialize bug - extra empty row at the end Pavel Stehule <pavel.stehule@gmail.com>
Re: xmlserialize bug - extra empty row at the end Isaac Morland <isaac.morland@gmail.com>
Re: xmlserialize bug - extra empty row at the end Tom Lane <tgl@sss.pgh.pa.us>
Re: xmlserialize bug - extra empty row at the end Isaac Morland <isaac.morland@gmail.com>
Re: xmlserialize bug - extra empty row at the end Pavel Stehule <pavel.stehule@gmail.com>
Re: xmlserialize bug - extra empty row at the end Isaac Morland <isaac.morland@gmail.com>
Re: xmlserialize bug - extra empty row at the end Jim Jones <jim.jones@uni-muenster.de>
Re: xmlserialize bug - extra empty row at the end Tom Lane <tgl@sss.pgh.pa.us>
Re: xmlserialize bug - extra empty row at the end Jim Jones <jim.jones@uni-muenster.de>
Re: xmlserialize bug - extra empty row at the end Pavel Stehule <pavel.stehule@gmail.com>
On 24.04.23 03:18, Tom Lane wrote:
> I wouldn't actually *use* pchomp here, because that induces an
> unnecessary
> copy of the result string. I had in mind more like copying pchomp's code
> to count up the trailing newline(s) and then pass a corrected length
> to cstring_to_text_with_len.
Changed.
> You could simplify matters by doing that in all cases, too. It should
> never find anything to remove in the non-indented case, but the check
> should be of negligible cost in context.
I'm not sure I understood it correctly.
The non-indented cases should never find anything and indented cases
with CONTENT strings do not add trailing newlines, so this is only
applicable with DOCUMENT .. INDENT, right?
Something like this would suffice?
if(xmloption_arg != XMLOPTION_DOCUMENT)
result = (text *) xmlBuffer_to_xmltype(buf);
else
{
int len = xmlBufferLength(buf);
const char *xmloutput = (const char *) xmlBufferContent(buf);
while (len > 0 && xmloutput[len - 1] == '\n')
len--;
result = cstring_to_text_with_len(xmloutput, len);
}
If we really agree on manually removing the trailing newlines I will
open a CF entry for this.
Best, Jim
В списке pgsql-hackers по дате отправления
От: Andrey M. Borodin
Дата:
От: Jesper Pedersen
Дата: