Re: xmlserialize bug - extra empty row at the end - Mailing list pgsql-hackers

From Tom Lane
Subject Re: xmlserialize bug - extra empty row at the end
Date
Msg-id 76417.1682299083@sss.pgh.pa.us
Whole thread Raw
In response to xmlserialize bug - extra empty row at the end  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Jim Jones <jim.jones@uni-muenster.de> writes:
> If we agree to remove it, the change wouldn't be substantial :) I guess 
> we could just pchomp it in the end of the function, as suggested by Tom. 
> Attached a draft patch.

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.

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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: buffer refcount leak in foreign batch insert code
Next
From: Alexander Korotkov
Date:
Subject: Re: duplicate function declaration in multirangetypes_selfuncs.c