mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Add a relkind field to RangeTblEntry to avoid some syscache lookups.
The recent additions for FDW support required checking foreign-table-ness in several places in the parse/plan chain. While it's not clear whether that would really result in a noticeable slowdown, it seems best to avoid any performance risk by keeping a copy of the relation's relkind in RangeTblEntry. That might have some other uses later, anyway. Per discussion.
This commit is contained in:
@ -894,6 +894,7 @@ addRangeTableEntry(ParseState *pstate,
|
||||
lockmode = isLockedRefname(pstate, refname) ? RowShareLock : AccessShareLock;
|
||||
rel = parserOpenTable(pstate, relation, lockmode);
|
||||
rte->relid = RelationGetRelid(rel);
|
||||
rte->relkind = rel->rd_rel->relkind;
|
||||
|
||||
/*
|
||||
* Build the list of effective column names using user-supplied aliases
|
||||
@ -956,6 +957,7 @@ addRangeTableEntryForRelation(ParseState *pstate,
|
||||
rte->rtekind = RTE_RELATION;
|
||||
rte->alias = alias;
|
||||
rte->relid = RelationGetRelid(rel);
|
||||
rte->relkind = rel->rd_rel->relkind;
|
||||
|
||||
/*
|
||||
* Build the list of effective column names using user-supplied aliases
|
||||
|
Reference in New Issue
Block a user