1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Add more sanity checks with callers of changeDependencyFor()

changeDependencyFor() returns the number of pg_depend entries changed,
or 0 if there is a problem.  The callers of this routine expect only one
dependency to change, but they did not check for the result returned.
The following code paths gain checks:
- Namespace for extensions.
- Namespace for various object types (see AlterObjectNamespace).
- Planner support function for a function.

Some existing error messages related to all that are reworded to be more
consistent with the project style, and the new error messages added
follow the same style.  This change has exposed one bug fixed a bit
earlier with bd5ddbe.

Reviewed-by: Heikki Linnakangas, Akshat Jaimini
Discussion: https://postgr.es/m/ZJzD/rn+UbloKjB7@paquier.xyz
This commit is contained in:
Michael Paquier
2023-07-10 13:08:10 +09:00
parent bd5ddbe866
commit 9b286858e3
6 changed files with 21 additions and 13 deletions

View File

@ -16608,7 +16608,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
NamespaceRelationId,
oldNspOid,
newNspOid) != 1)
elog(ERROR, "failed to change schema dependency for relation \"%s\"",
elog(ERROR, "could not change schema dependency for relation \"%s\"",
NameStr(classForm->relname));
}
if (!already_done)