Skip to content

Commit 5223dda

Browse files
committed
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.
1 parent a2e35b5 commit 5223dda

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/backend/parser/parse_relation.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,9 +993,6 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
993993
/*
994994
* Add an entry for a relation to the pstate's range table (p_rtable).
995995
*
996-
* If pstate is NULL, we just build an RTE and return it without adding it
997-
* to an rtable list.
998-
*
999996
* Note: formerly this checked for refname conflicts, but that's wrong.
1000997
* Caller is responsible for checking for conflicts in the appropriate scope.
1001998
*/
@@ -1011,6 +1008,8 @@ addRangeTableEntry(ParseState *pstate,
10111008
LOCKMODE lockmode;
10121009
Relation rel;
10131010

1011+
Assert(pstate != NULL);
1012+
10141013
rte->rtekind = RTE_RELATION;
10151014
rte->alias = alias;
10161015

@@ -1058,8 +1057,7 @@ addRangeTableEntry(ParseState *pstate,
10581057
* Add completed RTE to pstate's range table list, but not to join list
10591058
* nor namespace --- caller must do that if appropriate.
10601059
*/
1061-
if (pstate != NULL)
1062-
pstate->p_rtable = lappend(pstate->p_rtable, rte);
1060+
pstate->p_rtable = lappend(pstate->p_rtable, rte);
10631061

10641062
return rte;
10651063
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy