Remove PlannedStmt->resultRelations in favor of resultRelationRelids

PlannedStmt->resultRelations was an integer list of range table indexes
because at the time it was added (to Query), the Bitmapset data type did
not yet exist in Postgres.

0f4c170cf3 added a Bitmapset of result relations, so remove the integer
list of RTIs and use the more compact resultRelationRelids.

Discussion: https://postgr.es/m/CAApHDvqAOeOwCKh9g0gfxWa040%3DHyc7_oA%3DC59rjod8kXJDWyw%40mail.gmail.com
This commit is contained in:
Melanie Plageman 2026-03-30 09:51:28 -04:00
parent 0f4c170cf3
commit 39dcd10a2c
5 changed files with 4 additions and 9 deletions

View file

@ -780,8 +780,9 @@ overexplain_range_table(PlannedStmt *plannedstmt, ExplainState *es)
overexplain_bitmapset("Unprunable RTIs", plannedstmt->unprunableRelids,
es);
if (es->format != EXPLAIN_FORMAT_TEXT ||
plannedstmt->resultRelations != NIL)
overexplain_intlist("Result RTIs", plannedstmt->resultRelations, es);
!bms_is_empty(plannedstmt->resultRelationRelids))
overexplain_bitmapset("Result RTIs", plannedstmt->resultRelationRelids,
es);
/* Close group, we're all done */
ExplainCloseGroup("Range Table", "Range Table", false, es);

View file

@ -189,7 +189,6 @@ ExecSerializePlan(Plan *plan, EState *estate)
pstmt->rtable = estate->es_range_table;
pstmt->unprunableRelids = estate->es_unpruned_relids;
pstmt->permInfos = estate->es_rteperminfos;
pstmt->resultRelations = NIL;
pstmt->appendRelations = NIL;
pstmt->planOrigin = PLAN_STMT_INTERNAL;

View file

@ -733,7 +733,7 @@ ExecCreateScanSlotFromOuterPlan(EState *estate,
bool
ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
{
return list_member_int(estate->es_plannedstmt->resultRelations, scanrelid);
return bms_is_member(scanrelid, estate->es_plannedstmt->resultRelationRelids);
}
/* ----------------------------------------------------------------

View file

@ -657,7 +657,6 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
glob->prunableRelids);
result->permInfos = glob->finalrteperminfos;
result->subrtinfos = glob->subrtinfos;
result->resultRelations = glob->resultRelations;
result->appendRelations = glob->appendRelations;
result->subplans = glob->subplans;
result->rewindPlanIDs = glob->rewindPlanIDs;

View file

@ -117,10 +117,6 @@ typedef struct PlannedStmt
*/
List *permInfos;
/* rtable indexes of target relations for INSERT/UPDATE/DELETE/MERGE */
/* integer list of RT indexes, or NIL */
List *resultRelations;
/* RT indexes of relations targeted by INSERT/UPDATE/DELETE/MERGE */
Bitmapset *resultRelationRelids;