Fill EState.es_rteperminfos more systematically.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Mar 2023 18:10:57 +0000 (13:10 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Mar 2023 18:10:57 +0000 (13:10 -0500)
commitb803b7d132e3505ab77c29acf91f3d1caa298f95
treed93cd1634ecf89e8388ebc424c8b9ca25280cbb9
parente76cbb6cd64d9c9cdf76a56318ba5249bf694b69
Fill EState.es_rteperminfos more systematically.

While testing a fix for bug #17823, I discovered that EvalPlanQualStart
failed to copy es_rteperminfos from the parent EState, resulting in
failure if anything in EPQ execution wanted to consult that information.

This led me to conclude that commit a61b1f748 had been too haphazard
about where to fill es_rteperminfos, and that we need to be sure that
that happens exactly where es_range_table gets filled.  So I changed the
signature of ExecInitRangeTable to help ensure that this new requirement
doesn't get missed.  (Indeed, pgoutput.c was also failing to fill it.
Maybe we don't ever need it there, but I wouldn't bet on that.)

No test case yet; one will arrive with the fix for #17823.
But that needs to be back-patched, while this fix is HEAD-only.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org
src/backend/commands/copyfrom.c
src/backend/executor/execMain.c
src/backend/executor/execUtils.c
src/backend/replication/logical/worker.c
src/backend/replication/pgoutput/pgoutput.c
src/include/executor/executor.h