diff options
author | Noah Misch <noah@leadboat.com> | 2024-09-29 15:54:25 -0700 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2024-09-29 15:54:28 -0700 |
commit | da99df15c25d9c769f24a721f34ed062d0b5d4d2 (patch) | |
tree | 705b74d1c590328d298bceb0921556ca5aefa8de | |
parent | 4aad471688993d3f6cfb8afa8b3af52b2fbdc7a3 (diff) |
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.
-rw-r--r-- | src/backend/commands/tablecmds.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 9432fd6587a..0ad0dfbcc57 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -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) |