From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Correctly set userid of subquery relations' child rels |
Date: | 2023-02-20 15:15:20 |
Message-ID: | E1pU7su-0026K0-6e@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(at)gmail(dot)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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-02-20 15:17:41 | Re: pgsql: Add assert checking to pg_leftmost_one_pos32() and friends |
Previous Message | David Rowley | 2023-02-20 09:50:48 | pgsql: Optimize generate_orderedappend_paths |