Re: Add new for_each macros for iterating over a List that do not require ListCell pointer

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: Add new for_each macros for iterating over a List that do not require ListCell pointer
Дата
Msg-id 20231219155214.GA831499@nathanxps13
обсуждение исходный текст
Ответ на Re: Add new for_each macros for iterating over a List that do not require ListCell pointer  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Ответы Re: Add new for_each macros for iterating over a List that do not require ListCell pointer  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Re: Add new for_each macros for iterating over a List that do not require ListCell pointer  (vignesh C <vignesh21@gmail.com>)
Список pgsql-hackers
On Tue, Dec 19, 2023 at 03:44:43PM +0100, Jelte Fennema-Nio wrote:
> On Tue, 19 Dec 2023 at 11:59, vignesh C <vignesh21@gmail.com> wrote:
>> I noticed that this change can be done in several other places too.
> 
> My guess would be that ~90% of all existing foreach loops in the
> codebase can be easily rewritten (and simplified) using these new
> macros. So converting all of those would likely be quite a bit of
> work. In patch 0003 I only converted a few of them to get some
> coverage of the new macros and show how much simpler the usage of them
> is.

I'm not sure we should proceed with rewriting most/all eligible foreach
loops.  I think it's fine to use the new macros in new code or to update
existing loops in passing when changing nearby code, but rewriting
everything likely just introduces back-patching pain in return for little
discernible gain.

> And even once these patches are merged to master, I think we should
> only do any bulk changes if/when we backport these macros to all
> supported PG versions. Backporting to PG12 is probably the hardest,
> since List its internal layout got heavily changed in PG13. Probably
> not too hard though, in Citus we've had similar macros work since
> PG11. I'm also not sure what the policy is for backporting patches
> that introduce new functions/macros in public headers.

Unless there's some way to argue this is a bug, security issue, or data
corruption problem [0], I seriously doubt we will back-patch this.

[0] https://www.postgresql.org/support/versioning/

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: introduce dynamic shared memory registry
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: introduce dynamic shared memory registry