Re: silence compiler warning in brin.c

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: silence compiler warning in brin.c
Date: 2022-06-01 17:38:24
Message-ID: 20220601173824.GA2396891@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 01, 2022 at 01:06:21PM -0400, Tom Lane wrote:
> Zhihong Yu <zyu(at)yugabyte(dot)com> writes:
>> It seems the variable can be initialized to the value of GUCNestLevel since
>> later in the func:
>> /* Roll back any GUC changes executed by index functions */
>> AtEOXact_GUC(false, save_nestlevel);
>
> That seems pretty inappropriate. If, thanks to some future thinko,
> control were able to reach the AtEOXact_GUC call despite not having
> called NewGUCNestLevel, we'd want that to fail.

+1

> It looks like
> AtEOXact_GUC asserts nestLevel > 0, so that either 0 or -1 would
> do as an "invalid" value; I'd lean a bit to using 0.

I only chose -1 to follow a117ceb's example in amcheck. I have no
preference.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2022-06-01 17:38:40 Re: Handle infinite recursion in logical replication setup
Previous Message David G. Johnston 2022-06-01 17:35:55 Re: Assorted small doc patches