From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: xmlserialize bug - extra empty row at the end |
Date: | 2023-04-23 14:48:37 |
Message-ID: | CAFj8pRBD3+9XGniHP4cTAdUJ5hv+8YBWNqt-NybEveH87-18Qg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
ne 23. 4. 2023 v 14:42 odesílatel Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
napsal:
> On Sun, 23 Apr 2023 at 01:31, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>
>> Hi
>>
>> maybe I found a bug in xmlserialize
>>
>> SELECT xmlserialize(DOCUMENT '<foo><bar><val x="y">42</val></bar></foo>'
>> AS varchar INDENT);
>>
>> (2023-04-23 07:27:53) postgres=# SELECT xmlserialize(DOCUMENT
>> '<foo><bar><val x="y">42</val></bar></foo>' AS varchar INDENT);
>> ┌─────────────────────────┐
>> │ xmlserialize │
>> ╞═════════════════════════╡
>> │ <foo> ↵│
>> │ <bar> ↵│
>> │ <val x="y">42</val>↵│
>> │ </bar> ↵│
>> │ </foo> ↵│
>> │ │
>> └─────────────────────────┘
>> (1 row)
>>
>> Looks so there is an extra empty row.
>>
>
> I wouldn't necessarily worry about this much. There is not, as such, an
> extra blank line at the end; rather it is conventional that a text file
> should end with a newline character. That is, conventionally every single
> line in a text file ends with a newline character, meaning the only text
> file that doesn't end with a newline is the empty file. You can see this in
> tools like diff, which explicitly report "no newline at end of file" if the
> file ends with a different character.
>
> If you were to save the value to a file you would probably want it the way
> it is.
>
> That being said, this is a database column result and I agree it would
> look more elegant if the blank line in the display were not there. I might
> go so far as to change the psql display routines to not leave a blank line
> after the content in the event it ends with a newline.
>
psql shows to display content without changes. I don't think it should be
fixed on the client side.
But it can be easily fixed on the server side. I think there is some code
that tries to clean the end lines already.
regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2023-04-23 14:50:41 | Re: xmlserialize bug - extra empty row at the end |
Previous Message | Tom Lane | 2023-04-23 14:48:09 | Re: xmlserialize bug - extra empty row at the end |