Access root->simple_rte_array instead of Query->rtable for 2 more cases.

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Access root->simple_rte_array instead of Query->rtable for 2 more cases.
Date: 2021-05-25 18:00:49
Message-ID: CAKU4AWrxB28GHOpr480QkbBAupAySqymOunjaaMGjGqBiUWEHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When I am understanding the relationship between Query->rtable and
root->simple_rte_array, I'd like to assume that Query->rtable should be
never used
when root->simple_rte_array is ready. I mainly checked two places,
make_one_rel and
create_plan with the below hacks.

{
List *l = root->parse->rtable;
root->parse->rtable = NIL;
make_one_rel.. or create_plan_recurse..
root->parse->rtable = l;
}

Then I found adjust_appendrel_attrs_mutator and infer_arbiter_indexes still
use it. The attached patch fixed it by replacing the rt_fetch with
planner_rt_fetch,
all the tests passed.

--
Best Regards
Andy Fan (https://www.aliyun.com/)

Attachment Content-Type Size
v1-0001-Use-planner_rt_fetch-instead-of-rt_fetch-when-roo.patch application/octet-stream 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-05-25 18:04:01 Re: CALL versus procedures with output-only arguments
Previous Message Ranier Vilela 2021-05-25 17:43:51 Re: Possible pointer var TupleDesc rettupdesc used not initialized (src/backend/optimizer/util/clauses.c)