mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
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:
parent
118dfd1213
commit
db19924555
@ -3682,9 +3682,9 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
|
|||||||
relrelation = table_open(RelationRelationId, RowExclusiveLock);
|
relrelation = table_open(RelationRelationId, RowExclusiveLock);
|
||||||
|
|
||||||
reltup = SearchSysCacheLockedCopy1(RELOID, ObjectIdGetDatum(myrelid));
|
reltup = SearchSysCacheLockedCopy1(RELOID, ObjectIdGetDatum(myrelid));
|
||||||
otid = reltup->t_self;
|
|
||||||
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
|
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
|
||||||
elog(ERROR, "cache lookup failed for relation %u", myrelid);
|
elog(ERROR, "cache lookup failed for relation %u", myrelid);
|
||||||
|
otid = reltup->t_self;
|
||||||
relform = (Form_pg_class) GETSTRUCT(reltup);
|
relform = (Form_pg_class) GETSTRUCT(reltup);
|
||||||
|
|
||||||
if (get_relname_relid(newrelname, namespaceId) != InvalidOid)
|
if (get_relname_relid(newrelname, namespaceId) != InvalidOid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user