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:25 -0700 |
commit | 0d5a3d7574f8dabcbc229c2a06a9cb2d9a43c7c5 (patch) | |
tree | 4c55d206e83a4b711a153568da396cd21ce8ed9f /src/backend/commands/tablecmds.c | |
parent | e9339782a631eeef01281bc7e1633dd6b970106e (diff) | |
download | postgresql-0d5a3d7574f8dabcbc229c2a06a9cb2d9a43c7c5.tar.gz postgresql-0d5a3d7574f8dabcbc229c2a06a9cb2d9a43c7c5.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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 87232e01376..7405023e77b 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -4132,9 +4132,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) |