aboutsummaryrefslogtreecommitdiff
path: root/src
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
commit159bf0f31b59f7ef7f4bc6c3f57a5187f6a96947 (patch)
tree85d26a903ac7d34b5d02b199c3b23b1c0c4515fc /src
parent7f90b727422bde6308fd22b7fb0aef48255fd6db (diff)
downloadpostgresql-159bf0f31b59f7ef7f4bc6c3f57a5187f6a96947.tar.gz
postgresql-159bf0f31b59f7ef7f4bc6c3f57a5187f6a96947.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')
-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 f3050d8a1d2..e6c911fd9a4 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -3893,9 +3893,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)