Re: Fix typo with logical connector (src/backend/commands/vacuumparallel.c)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix typo with logical connector (src/backend/commands/vacuumparallel.c)
Date: 2022-08-19 13:28:19
Message-ID: 3041648.1660915699@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
> At function parallel_vacuum_process_all_indexes there is
> a typo with a logical connector.
> I think that correct is &&, because both of the operators are
> bool types [1].
> As a result, parallel vacuum workers can be incorrectly enabled.

Since they're bools, the C spec requires them to promote to integer
0 or 1, therefore the & operator will yield the desired result.
So there's not going to be any incorrect behavior. Nonetheless,
I agree that && would be better, because it would short-circuit
the evaluation of parallel_vacuum_index_is_parallel_safe() when
there's no need.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-08-19 13:30:16 Re: MERGE and parsing with prepared statements
Previous Message David Geier 2022-08-19 13:03:35 Re: Reducing planning time on tables with many indexes