brin: Remove duplicate initialization in initialize_brin_buildstate()

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: brin: Remove duplicate initialization in initialize_brin_buildstate()
Date: 2026-01-21 06:29:54
Message-ID: CAEoWx2nmrca6-9SNChDvRYD6+r==fs9qg5J93kahS7vpoq8QVg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-brin-Remove-duplicate-initialization-in-initializ.patch application/octet-stream 1.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-01-21 06:32:53 Re: Skipping schema changes in publication
Previous Message VASUKI M 2026-01-21 06:29:24 Re: Optional skipping of unchanged relations during ANALYZE?