Re: brin: Remove duplicate initialization in initialize_brin_buildstate()

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: brin: Remove duplicate initialization in initialize_brin_buildstate()
Date: 2026-03-09 15:10:22
Message-ID: CAHGQGwGhSSnH-o6x6RCOEwdYLDiWT9T0=ENNr5P3WRmtqcWeQw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 11, 2026 at 11:33 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>
>
> > On Feb 11, 2026, at 09:23, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com> wrote:
> >
> > On Wed, Jan 21, 2026 at 3:30 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> >>
> >> Hi Hacker,
> >>
> >> Just noticed a redundant assignment in initialize_brin_buildstate():
> >>
> >> ```
> >> static BrinBuildState *
> >> initialize_brin_buildstate(Relation idxRel, BrinRevmap *revmap,
> >> BlockNumber pagesPerRange, BlockNumber tablePages)
> >> {
> >> BrinBuildState *state;
> >> BlockNumber lastRange = 0;
> >>
> >> state = palloc_object(BrinBuildState);
> >>
> >> <…omit some lines…>
> >>
> >> // Later, b437571 added the same again. This patch deletes these 3 lines.
> >> state->bs_context = CurrentMemoryContext;
> >> state->bs_emptyTuple = NULL;
> >> state->bs_emptyTupleLen = 0;
> >>
> >> // Added by dae761a first
> >> /* Remember the memory context to use for an empty tuple, if needed. */
> >> state->bs_context = CurrentMemoryContext;
> >> state->bs_emptyTuple = NULL;
> >> state->bs_emptyTupleLen = 0;
> >> ```
> >>
> >> So, filing a trivial patch to eliminate the redundancy.
> >
> > Thank you for the patch! It looks good to me, so I’ve marked the entry
> > as Ready for Committer.

LGTM. Barring any objections, I will commit the patch.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ahmed Amr 2026-03-09 15:24:28 Question about foreign-key-based join removal in analyzejoins.c
Previous Message Greg Sabino Mullane 2026-03-09 15:07:05 Re: psql's 001_basic.pl test could fail on very slow machines