Reusing return value from planner_rt_fetch

Started by Zhihong Yualmost 4 years ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46870
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 01:45 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t46870_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t46870_1 && git checkout t46870_1

Patchset v1 (message #1) is on t46870_1

Jump to latest
#1Zhihong Yu
zyu@yugabyte.com

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

Attachments:

t46870_1
parent-rel-rte.patchapplication/octet-stream; name=parent-rel-rte.patchDownload+4-4
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Zhihong Yu (#1)
Re: Reusing return value from planner_rt_fetch

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