Thread: pgsql: Correctly set userid of subquery relations' child rels
Correctly set userid of subquery relations' child rels The RelOptInfo->userid field (the user ID to check permissions as) of an "otherrel" relation was being copied from its parent relation, which is correct in most cases but wrong when the parent is a subquery. In that case, using the value from the RTEPermissionInfo of the child itself is the appropriate thing to do. Coming up with a test case where user-visible behavior changes proves hard enough, so we don't add one here. Bug introduced by a61b1f74823c, discovered by Amit while reviewing nearby code. Author: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/CA+HiwqE0WY_AhLnGtTsY7eYebG212XWbM-D8gr2A_ToOHyCywQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a316a3bc6d3f57e3fe0d287d11eb4f114388b1b6 Modified Files -------------- src/backend/optimizer/util/relnode.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)