From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: silence compiler warning in brin.c
Date: Wed, 01 Jun 2022 17:08:03 -0400
Message-ID: <710790.1654117683@sss.pgh.pa.us> (raw)
In-Reply-To: <20220601173824.GA2396891@nathanxps13>
References: <20220601163537.GA2331988@nathanxps13>
<CALNJ-vTvL-kvQ0CAbZxOvSR=PuOi1MbtywE=tdG2hhqSnZVkRw@mail.gmail.com>
<626379.1654103181@sss.pgh.pa.us>
<20220601173824.GA2396891@nathanxps13>
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Wed, Jun 01, 2022 at 01:06:21PM -0400, Tom Lane wrote:
>> 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.
Hmm, if we're following amcheck's example it should be more like this:
inline patch 1: src/backend/access/brin/brin.c (+6/-0 lines) download inline-1.patchdiff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.cindex 52f171772d..0de1441dc6 100644--- a/src/backend/access/brin/brin.c+++ b/src/backend/access/brin/brin.c@@ -1051,7 +1051,13 @@ brin_summarize_range(PG_FUNCTION_ARGS)
save_nestlevel = NewGUCNestLevel();
}
else
+ {
heapRel = NULL;
+ /* Set these just to suppress "uninitialized variable" warnings */+ save_userid = InvalidOid;+ save_sec_context = -1;+ save_nestlevel = -1;+ }
indexRel = index_open(indexoid, ShareUpdateExclusiveLock);
I like this better anyway since the fact that the other two variables
aren't warned about seems like an implementation artifact.
regards, tom lane
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: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, zyu@yugabyte.com
Subject: Re: silence compiler warning in brin.c
In-Reply-To: <710790.1654117683@sss.pgh.pa.us>
* 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