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

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)
Дата
Msg-id CAApHDvrn2RCjEr=y++CJPi3D5yUfUnmvZCPN6oTPZ7D=RjGgcw@mail.gmail.com
обсуждение исходный текст
Ответ на Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-hackers
On Wed, 21 Dec 2022 at 13:15, Ranier Vilela <ranier.vf@gmail.com> wrote:
> IMO, I think that commit a61b1f7, has an oversight.
> Currently is losing the result of recursion of function translate_col_privs_multilevel.
>
> Once the variable result (Bitmapset pointer) is reassigned.
>
> Without a test case for this patch.
> But also, do not have a test case for the current thinko in head.

hmm, that code looks a bit suspect to me too.

Are you able to write a test that shows the bug which fails before
your change and passes after applying it? I don't think it's quite
enough to claim that your changes pass make check given that didn't
fail before your change.

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.

David



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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: New strategies for freezing, advancing relfrozenxid early
Следующее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: Refactor SCRAM code to dynamically handle hash type and key length