Skip to content

Commit b9ee133

Browse files
committed
Remove NULL dereference from RenameRelationInternal().
Defect in last week's commit aac2c9b, per Coverity. Reaching this would need catalog corruption. Back-patch to v12, like that commit.
1 parent 0c827fb commit b9ee133

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3861,9 +3861,9 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
38613861
relrelation = table_open(RelationRelationId, RowExclusiveLock);
38623862

38633863
reltup = SearchSysCacheLockedCopy1(RELOID, ObjectIdGetDatum(myrelid));
3864-
otid = reltup->t_self;
38653864
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
38663865
elog(ERROR, "cache lookup failed for relation %u", myrelid);
3866+
otid = reltup->t_self;
38673867
relform = (Form_pg_class) GETSTRUCT(reltup);
38683868

38693869
if (get_relname_relid(newrelname, namespaceId) != InvalidOid)

0 commit comments

Comments
 (0)