Re: [BUG] pgbench nested \if conditions incorrectly processed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUG] pgbench nested \if conditions incorrectly processed
Date: 2024-12-15 18:40:27
Message-ID: 1722881.1734288027@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com> writes:
> I’ve found an issue with pgbench: it processes nested \if conditions
> incorrectly.

Right you are.

> Attached is a fix that addresses this issue, along with a regression test.

Code fix looks good, but I don't agree with creating a separate
test script for this --- that entails spinning up an entire new
server instance, which is an awful lot of cycles to expend in
every check-world run forevermore for this size of problem.
I'll just add the test case to 001_pgbench_with_server.pl instead.

Looking at the code coverage report [1], it seems we are also missing
any test that covers \if in the IFSTATE_IGNORED/IFSTATE_ELSE_FALSE
case. That code appears correct, but given this bug it seems prudent
to extend the test to cover that path too. I'll do that and push.

regards, tom lane

[1] https://coverage.postgresql.org/src/bin/pgbench/pgbench.c.gcov.html#3915

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2024-12-15 18:43:24 Re: bt_index_parent_check and concurrently build indexes
Previous Message Andrey M. Borodin 2024-12-15 17:58:09 Re: Sort functions with specialized comparators