Commit 5223ddac authored by Robert Haas's avatar Robert Haas

Remove residual NULL-pstate handling in addRangeTableEntry.

Passing a NULL pstate wouldn't actually work, because isLockedRefname()
isn't prepared to cope with it; and there hasn't been any in-core code
that tries in over a decade.  So just remove the residual NULL handling.

Spotted by Coverity; analysis and patch by Michael Paquier.
parent a2e35b53
...@@ -993,9 +993,6 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode) ...@@ -993,9 +993,6 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
/* /*
* Add an entry for a relation to the pstate's range table (p_rtable). * Add an entry for a relation to the pstate's range table (p_rtable).
* *
* If pstate is NULL, we just build an RTE and return it without adding it
* to an rtable list.
*
* Note: formerly this checked for refname conflicts, but that's wrong. * Note: formerly this checked for refname conflicts, but that's wrong.
* Caller is responsible for checking for conflicts in the appropriate scope. * Caller is responsible for checking for conflicts in the appropriate scope.
*/ */
...@@ -1011,6 +1008,8 @@ addRangeTableEntry(ParseState *pstate, ...@@ -1011,6 +1008,8 @@ addRangeTableEntry(ParseState *pstate,
LOCKMODE lockmode; LOCKMODE lockmode;
Relation rel; Relation rel;
Assert(pstate != NULL);
rte->rtekind = RTE_RELATION; rte->rtekind = RTE_RELATION;
rte->alias = alias; rte->alias = alias;
...@@ -1058,7 +1057,6 @@ addRangeTableEntry(ParseState *pstate, ...@@ -1058,7 +1057,6 @@ addRangeTableEntry(ParseState *pstate,
* Add completed RTE to pstate's range table list, but not to join list * Add completed RTE to pstate's range table list, but not to join list
* nor namespace --- caller must do that if appropriate. * nor namespace --- caller must do that if appropriate.
*/ */
if (pstate != NULL)
pstate->p_rtable = lappend(pstate->p_rtable, rte); pstate->p_rtable = lappend(pstate->p_rtable, rte);
return rte; return rte;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment