Skip to content

Commit 159bf0f

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 7f90b72 commit 159bf0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/commands/tablecmds.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3893,9 +3893,9 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
38933893
relrelation = table_open(RelationRelationId, RowExclusiveLock);
38943894

38953895
reltup = SearchSysCacheLockedCopy1(RELOID, ObjectIdGetDatum(myrelid));
3896-
otid = reltup->t_self;
38973896
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
38983897
elog(ERROR, "cache lookup failed for relation %u", myrelid);
3898+
otid = reltup->t_self;
38993899
relform = (Form_pg_class) GETSTRUCT(reltup);
39003900

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

0 commit comments

Comments
 (0)