From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
Date: Fri, 13 Sep 2019 16:31:32 -0300
Message-ID: <20190913193132.GA18625@alvherre.pgsql> (raw)
In-Reply-To: <19795.1568400476@sss.pgh.pa.us>
On 2019-Sep-13, Tom Lane wrote:
> Not a new problem of this patch, exactly, but:
>
> /* Reindex options */
> #define REINDEXOPT_VERBOSE 1 << 0 /* print progress info */
> +#define REINDEXOPT_REPORT_PROGRESS 1 << 1 /* report pgstat progress */
>
> Surely these macro definitions are incredibly dangerous due to their
> lack of parentheses.
>
> I'd initially thought that we already had bugs in existing usages like
>
> if (options & REINDEXOPT_VERBOSE)
>
> After consulting a nearby C reference I see that we're accidentally
> saved by << having higher priority than &, but this is not safely-
> maintainable code. Expressions like "~REINDEXOPT_VERBOSE" would not
> do what one expects.
Fixed back to 9.5, where this macro appeared. I was unable to come up
with a way to search for other occurrences of the same problem :-(
Thanks,
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
In-Reply-To: <20190913193132.GA18625@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox