Hello Nikolay,
> I did some investigation: The code there really suppose that there is always
> \n at the end of the line, and truncates the line. It is done in
>
> /* Get location of the ending newline */
> end_offset = expr_scanner_offset(sstate) - 1;
>
> just two lines above the code we are discussing.
>
> When you have one line code /sleep 2ms with no "end of line" symbol at the
> end, it will cut off "s" instead of "\n"
>
> You've fix it, but now it will leave \n, in all sleeps in multiline scripts.
>
> So this should be fixed in both expr_scanner_get_substring cases, and keep last
> symbol only if it is not "\n".
Indeed, this is a mess. The code assumes all stuff is a line ending with
'\n', but this is not always the case.
>> Also, if someone could run a test on windows, it would be great.
> I'll try to ask a friend of mine to run this on windows...
That would be great!
Here is a v7 which chomps the final newline only if there is one.
Thanks again,
--
Fabien.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers