Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)
Дата
Msg-id CAMbWs488Udp_Z7tUm0eUd3gtXZd3Wx2kDGhHat2Di+1UFkc3EA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers

On Wed, Dec 21, 2022 at 9:45 AM David Rowley <dgrowleyml@gmail.com> wrote:
Also, I think it might be better to take the opportunity to rewrite
the function to not use recursion. I don't quite see the need for it
here and it looks like that might have helped contribute to the
reported issue.  Can't we just write this as a while loop instead of
having the function call itself? It's not as if we need stack space
for keeping track of multiple parents. A child relation can only have
1 parent. It seems to me that we can just walk there by looping.
 
My best guess is that this function is intended to share the same code
pattern as in adjust_appendrel_attrs_multilevel.  The recursion is
needed as 'rel' can be more than one inheritance level below the top
parent.  I think we can keep the recursion, as in other similar
functions, as long as we make it right, as in attached patch.

Thanks
Richard
Вложения

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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Force streaming every change in logical decoding
Следующее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures