diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-06 13:10:57 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-06 13:10:57 -0500 |
commit | b803b7d132e3505ab77c29acf91f3d1caa298f95 (patch) | |
tree | d93cd1634ecf89e8388ebc424c8b9ca25280cbb9 /src/backend/executor/execMain.c | |
parent | e76cbb6cd64d9c9cdf76a56318ba5249bf694b69 (diff) | |
download | postgresql-b803b7d132e3505ab77c29acf91f3d1caa298f95.tar.gz postgresql-b803b7d132e3505ab77c29acf91f3d1caa298f95.zip |
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
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 39bfb48dc22..7f5968db873 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -807,15 +807,14 @@ InitPlan(QueryDesc *queryDesc, int eflags) int i; /* - * Do permissions checks and save the list for later use. + * Do permissions checks */ ExecCheckPermissions(rangeTable, plannedstmt->permInfos, true); - estate->es_rteperminfos = plannedstmt->permInfos; /* * initialize the node's execution state */ - ExecInitRangeTable(estate, rangeTable); + ExecInitRangeTable(estate, rangeTable, plannedstmt->permInfos); estate->es_plannedstmt = plannedstmt; estate->es_part_prune_infos = plannedstmt->partPruneInfos; @@ -2805,11 +2804,12 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree) rcestate->es_range_table = parentestate->es_range_table; rcestate->es_range_table_size = parentestate->es_range_table_size; rcestate->es_relations = parentestate->es_relations; - rcestate->es_queryEnv = parentestate->es_queryEnv; rcestate->es_rowmarks = parentestate->es_rowmarks; + rcestate->es_rteperminfos = parentestate->es_rteperminfos; rcestate->es_plannedstmt = parentestate->es_plannedstmt; rcestate->es_junkFilter = parentestate->es_junkFilter; rcestate->es_output_cid = parentestate->es_output_cid; + rcestate->es_queryEnv = parentestate->es_queryEnv; /* * ResultRelInfos needed by subplans are initialized from scratch when the |