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 14:30:13 -0700
Message-ID: <20220601213013.GA2400888@nathanxps13> (raw)
In-Reply-To: <710790.1654117683@sss.pgh.pa.us>
References: <20220601163537.GA2331988@nathanxps13>
	<CALNJ-vTvL-kvQ0CAbZxOvSR=PuOi1MbtywE=tdG2hhqSnZVkRw@mail.gmail.com>
	<626379.1654103181@sss.pgh.pa.us>
	<20220601173824.GA2396891@nathanxps13>
	<710790.1654117683@sss.pgh.pa.us>

On Wed, Jun 01, 2022 at 05:08:03PM -0400, Tom Lane wrote:
> Hmm, if we're following amcheck's example it should be more like this:
> 
> diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
> index 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.

Yeah, that is better.  It's not clear why the other variables aren't
subject to the same warnings, so we might as well cover our bases.

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





view thread (8+ messages)

Message-ID: <20220601213013.GA2400888@nathanxps13>
Permalink:  ../20220601213013.GA2400888@nathanxps13/
Also on:    postgresql.org/message-id/20220601213013.GA2400888@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: <20220601213013.GA2400888@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