Re: silence compiler warning in brin.c

2022-06-01 Thread Nathan Bossart
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/s

Re: silence compiler warning in brin.c

2022-06-01 Thread Tom Lane
Nathan Bossart 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 > pr

Re: silence compiler warning in brin.c

2022-06-01 Thread Tom Lane
Zhihong Yu writes: > Hi, > if (heapRel == NULL || heapoid != IndexGetRelation(indexoid, false)) > ereport(ERROR, > I wonder why the above check is not placed in the else block: > else > heapRel = NULL; Because we don't want to throw that error until we've exhausted the

Re: silence compiler warning in brin.c

2022-06-01 Thread Zhihong Yu
On Wed, Jun 1, 2022 at 10:06 AM Tom Lane wrote: > Zhihong Yu writes: > > On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart > > wrote: > >> I'm seeing a compiler warning in brin.c with an older version of gcc. > >> Specifically, it seems worried that a variable might not be initialized. > >> AFAICT

Re: silence compiler warning in brin.c

2022-06-01 Thread Nathan Bossart
On Wed, Jun 01, 2022 at 01:06:21PM -0400, Tom Lane wrote: > Zhihong Yu 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); > > Th

Re: silence compiler warning in brin.c

2022-06-01 Thread Tom Lane
Zhihong Yu writes: > On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart > wrote: >> I'm seeing a compiler warning in brin.c with an older version of gcc. >> Specifically, it seems worried that a variable might not be initialized. >> AFAICT there is no real risk, so I've attached a small patch to silen

Re: silence compiler warning in brin.c

2022-06-01 Thread Zhihong Yu
On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart wrote: > Hi hackers, > > I'm seeing a compiler warning in brin.c with an older version of gcc. > Specifically, it seems worried that a variable might not be initialized. > AFAICT there is no real risk, so I've attached a small patch to silence the > w

silence compiler warning in brin.c

2022-06-01 Thread Nathan Bossart
Hi hackers, I'm seeing a compiler warning in brin.c with an older version of gcc. Specifically, it seems worried that a variable might not be initialized. AFAICT there is no real risk, so I've attached a small patch to silence the warning. -- Nathan Bossart Amazon Web Services: https://aws.amazo