Tidy fill hstv array (src/backend/access/heap/pruneheap.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Tidy fill hstv array (src/backend/access/heap/pruneheap.c)
Date: 2023-12-28 12:57:54
Message-ID: CAEudQArhe-JXZU6O-XoiwzTS7x1xXd=0=yJh9yC1T3v6XxSYBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The function heap_page_prune (src/backend/access/heap/pruneheap.c)
Has a comment:

"/*
* presult->htsv is not initialized here because all ntuple spots in the
* array will be set either to a valid HTSV_Result value or -1.
*/

IMO, this is a little bogus and does not make sense.

I think it would be more productive to initialize the entire array with -1,
and avoid flagging, one by one, the items that should be -1.

Patch attached.

best regards,
Ranier Vilela

Attachment Content-Type Size
001-tidy-fill-htsv-array.patch application/octet-stream 1.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-12-28 14:24:59 Re: Multidimensional Histograms
Previous Message Ian Lawrence Barwick 2023-12-28 12:46:12 Re: doc patch: note AttributeRelationId passed to FDW validator function