Re: Fix and improve allocation formulas

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix and improve allocation formulas
Date: 2025-12-18 04:47:01
Message-ID: aUOHRUEBtz1zmhuc@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 17, 2025 at 09:24:31AM +0000, Bertrand Drouvot wrote:
> I'd vote for just changing the palloc() like proposed in v1.

It does not seem that bad if we treat the uint8 rule for actual bytes,
but I'm going to leave that for others to comment for now.

By the way, while checking again the whole, David has proposed
something different for btree_utils_var.c still a bit incorrect:
https://www.postgresql.org/message-id/4ab4a12b-49e9-4ebf-9055-225c8055fed0@gmail.com

I had my eyes on it a couple of days ago and noticed the bytea vs
GBT_VARKEY business, but discarded it to look at the rest first
because there were a lot of patterns to look at. His solution used
palloc_array(), with a "bytea *". Okay, that's actually the same as
btree_utils_var.h tells that bytea and GBT_VARKEY are the same thing,
but there is also a point in being consistent in the code with what
the header wants. So I have reused the palloc_array() with
GBT_VARKEY, meaning that the solution of 5cf03552fbb4 is a mix of what
both of you have proposed, except that it's consistent with the
declaration.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-12-18 04:52:45 Re: Sequence Access Methods, round two
Previous Message Soumya S Murali 2025-12-18 04:46:06 Re: [PATCH] Expose checkpoint reason to completion log messages.