postgresql/src/backend/optimizer/util
Alvaro Herrera a316a3bc6d
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 a61b1f7482, 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
2023-02-20 16:00:42 +01:00
..
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
appendinfo.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
clauses.c Make Vars be outer-join-aware. 2023-01-30 13:16:20 -05:00
inherit.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
joininfo.c Make Vars be outer-join-aware. 2023-01-30 13:16:20 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
orclauses.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
paramassign.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
pathnode.c Remove dead NoMovementScanDirection code 2023-02-01 10:52:41 +13:00
placeholder.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
plancat.c Allow left join removals and unique joins on partitioned tables 2023-01-09 17:15:08 +13:00
predtest.c Remove useless casts to (void *) in hash_search() calls 2023-02-06 09:41:01 +01:00
relnode.c Correctly set userid of subquery relations' child rels 2023-02-20 16:00:42 +01:00
restrictinfo.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
tlist.c Fix typos in comments, code and documentation 2023-01-03 16:26:14 +09:00
var.c Fix thinko in outer-join removal. 2023-02-04 15:19:54 -05:00