Re: xmlserialize bug - extra empty row at the end
От | Isaac Morland |
---|---|
Тема | Re: xmlserialize bug - extra empty row at the end |
Дата | |
Msg-id | CAMsGm5eEhP5AnmmLANEPzwzm062WXOpjSCaSqCfFETdmz8bQUA@mail.gmail.com обсуждение исходный текст |
Ответ на | xmlserialize bug - extra empty row at the end (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: xmlserialize bug - extra empty row at the end
Re: xmlserialize bug - extra empty row at the end |
Список | pgsql-hackers |
On Sun, 23 Apr 2023 at 01:31, Pavel Stehule <pavel.stehule@gmail.com> wrote:
Himaybe I found a bug in xmlserializeSELECT 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.
В списке pgsql-hackers по дате отправления: