aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_relation.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-03-03 16:31:26 -0500
committerRobert Haas <rhaas@postgresql.org>2015-03-03 16:31:26 -0500
commit5223ddacdc737b401ed58184e321f354bdf46686 (patch)
tree92d677955382c8643ff581b793fca9a58fb54409 /src/backend/parser/parse_relation.c
parenta2e35b53c39b2a27d3e332dc7c506539c306fd44 (diff)
downloadpostgresql-5223ddacdc737b401ed58184e321f354bdf46686.tar.gz
postgresql-5223ddacdc737b401ed58184e321f354bdf46686.zip
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.
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-rw-r--r--src/backend/parser/parse_relation.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 8d4f79fd986..f416fc2a45e 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -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).
*
- * 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.
* Caller is responsible for checking for conflicts in the appropriate scope.
*/
@@ -1011,6 +1008,8 @@ addRangeTableEntry(ParseState *pstate,
LOCKMODE lockmode;
Relation rel;
+ Assert(pstate != NULL);
+
rte->rtekind = RTE_RELATION;
rte->alias = alias;
@@ -1058,8 +1057,7 @@ addRangeTableEntry(ParseState *pstate,
* Add completed RTE to pstate's range table list, but not to join list
* 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;
}