aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2024-09-29 15:54:25 -0700
committerNoah Misch <noah@leadboat.com>2024-09-29 15:54:29 -0700
commitb9ee1339bfbe078ee04468dfce2820248061155b (patch)
tree092c1b60e686c7c058f230e10a9fea3d3b203234 /src/backend/commands/tablecmds.c
parent0c827fbdb81ad873921c3fae4d973151d8a00785 (diff)
downloadpostgresql-b9ee1339bfbe078ee04468dfce2820248061155b.tar.gz
postgresql-b9ee1339bfbe078ee04468dfce2820248061155b.zip
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.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 2c68d89f379..38cc7f6b854 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -3861,9 +3861,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)