Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Ranier Vilela <ranier.vf@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2022-12-22T08:18:13Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-translate_col_privs_multilevel.patch (application/octet-stream) patch v1-0001
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
Commits
-
Fix bug in translate_col_privs_multilevel
- bbfdf7180de8 16.0 landed
-
Rework query relation permission checking
- a61b1f74823c 16.0 cited