Re: [HACKERS] pgbench tap tests & minor fixes - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] pgbench tap tests & minor fixes
Date
Msg-id alpine.DEB.2.20.1706081952470.12833@lancre
Whole thread Raw
In response to Re: [HACKERS] pgbench tap tests & minor fixes  (Nikolay Shaplov <dhyan@nataraj.su>)
Responses Re: [HACKERS] pgbench tap tests & minor fixes
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] PostgreSQL 10 changes in exclusion constraints - did something change? CASE WHEN behavior oddity
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] PG10 transition tables, wCTEs and multiple operationson the same table