Re: pgbench tap tests & minor fixes

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: pgbench tap tests & minor fixes
Date: 2017-06-08 17:56:02
Message-ID: alpine.DEB.2.20.1706081952470.12833@lancre
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: 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.

Attachment Content-Type Size
pgbench-tap-7.patch text/x-diff 30.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-06-08 17:59:00 Re: PG10 transition tables, wCTEs and multiple operations on the same table
Previous Message Tom Lane 2017-06-08 17:50:57 Re: PostgreSQL 10 changes in exclusion constraints - did something change? CASE WHEN behavior oddity