Thread: Reusing return value from planner_rt_fetch

Reusing return value from planner_rt_fetch

From
Zhihong Yu
Date:
Hi,
I was reading examine_variable in src/backend/utils/adt/selfuncs.c

It seems we already have the rte coming out of the loop which starts on line 5181.

Here is a patch which reuses the return value from `planner_rt_fetch`.

Please take a look.

Thanks
Attachment

Re: Reusing return value from planner_rt_fetch

From
Tom Lane
Date:
Zhihong Yu <zyu@yugabyte.com> writes:
> I was reading examine_variable in src/backend/utils/adt/selfuncs.c
> It seems we already have the rte coming out of the loop which starts on
> line 5181.
> Here is a patch which reuses the return value from `planner_rt_fetch`.

planner_rt_fetch is not so expensive that we should contort the code
to avoid one call.  So I'm not sure this is an improvement.  It
doesn't seem to be more readable, and it adds assumptions on
whether appinfo is initially null or becomes so later.

            regards, tom lane