pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: silence compiler warning in brin.c
Date: Wed, 1 Jun 2022 10:38:24 -0700
Message-ID: <20220601173824.GA2396891@nathanxps13> (raw)
In-Reply-To: <626379.1654103181@sss.pgh.pa.us>
References: <20220601163537.GA2331988@nathanxps13>
	<CALNJ-vTvL-kvQ0CAbZxOvSR=PuOi1MbtywE=tdG2hhqSnZVkRw@mail.gmail.com>
	<626379.1654103181@sss.pgh.pa.us>

On Wed, Jun 01, 2022 at 01:06:21PM -0400, Tom Lane wrote:
> Zhihong Yu <zyu@yugabyte.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





view thread (8+ messages)  latest in thread

Message-ID: <20220601173824.GA2396891@nathanxps13>
Permalink:  ../20220601173824.GA2396891@nathanxps13/
Also on:    postgresql.org/message-id/20220601173824.GA2396891@nathanxps13

 · 

reply

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-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, tgl@sss.pgh.pa.us, zyu@yugabyte.com
  Subject: Re: silence compiler warning in brin.c
  In-Reply-To: <20220601173824.GA2396891@nathanxps13>

* 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