Fix PrivateRefCount hash table key size

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Fix PrivateRefCount hash table key size
Date: 2025-12-02 14:43:25
Message-ID: aS77DTpl0fOkIKSZ@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While working on [1], I noticed that there is a type mismatch when computing
the key size for the PrivateRefCount hash table. Indeed, the first
PrivateRefCountEntry member type is Buffer (int), so the keysize should be
sizeof(Buffer) and not sizeof(int32).

PFA attached a patch to fix it.

It has been kind of automatically detected while working on [1], so I'm pretty
confident there are no other type mismatches for hash table key size.

Note that this is exactly the kind of issue that the macro proposed in [1] would
avoid.

[1]: https://www.postgresql.org/message-id/flat/aS2b3LoUypW1/Gdz%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Fix-PrivateRefCount-hash-table-key-size.patch text/x-diff 1015 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-12-02 14:47:29 Re: POC: make mxidoff 64 bits
Previous Message Bertrand Drouvot 2025-12-02 14:39:07 Re: Remove useless casting to the same type