Re: Safer hash table initialization macro

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Re: Safer hash table initialization macro
Дата
Msg-id DEPJFNNOXN6C.39PM8C3I63DKU@jeltef.nl
обсуждение исходный текст
Ответ на Re: Safer hash table initialization macro  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Ответы Re: Safer hash table initialization macro
Список pgsql-hackers
On Wed Dec 3, 2025 at 12:17 PM CET, Bertrand Drouvot wrote:
> I suggest we move forward one
> step at a time, first step being the new macros. Does that make sense to you?

Normally I would agree, but in this case I think the new macros you
proposing would become obsolete once we have the better hash table
creation functions I have in mind. And if we're going to update all
places where we create hash tables, I'd rather update them to something
really nice than a small improvement.

I couldn't let it go (nerd-sniped). So here's a patchset that adds some
macros that I think are pretty nice. Including a foreach_hash macro.

I'm a bit on the fence about the C11 _Generic code to determine whether
we should use HASH_BLOBS or HASH_STRINGS based on the type of the key.
It works really nicely in practice, but I'm worried it's a bit too much
magic. Probably we should at least have an override to allow using
HASH_BLOBS anyway for a char array (in case it's not null terminated).

Вложения

В списке pgsql-hackers по дате отправления: