Remove NULL dereference from RenameRelationInternal().

Defect in last week's commit aac2c9b4fde889d13f859c233c2523345e72d32b,
per Coverity.  Reaching this would need catalog corruption.  Back-patch
to v12, like that commit.
This commit is contained in:
Noah Misch 2024-09-29 15:54:25 -07:00 committed by Muhammad Usama
parent 05c4d930e1
commit 9363b329b2

View File

@ -4143,9 +4143,9 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
relrelation = table_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheLockedCopy1(RELOID, ObjectIdGetDatum(myrelid));
otid = reltup->t_self;
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", myrelid);
otid = reltup->t_self;
relform = (Form_pg_class) GETSTRUCT(reltup);
if (get_relname_relid(newrelname, namespaceId) != InvalidOid)