Fix come incorrect elog() messages in aclchk.c
authorMichael Paquier <[email protected]>
Fri, 23 Dec 2022 01:04:36 +0000 (10:04 +0900)
committerMichael Paquier <[email protected]>
Fri, 23 Dec 2022 01:04:36 +0000 (10:04 +0900)
Three error strings used with cache lookup failures were referring to
incorrect object types for ACL checks:
- Schemas
- Types
- Foreign Servers
There errors should never be triggered, but if they do incorrect
information would be reported.

Author: Justin Pryzby
Discussion: https://postgr.es/m/20221222153041[email protected]
Backpatch-through: 11

src/backend/catalog/aclchk.c

index e2970bfb005f1c617e1525402e62328aa8ed4246..30c601c23d2c5ffbbde221c82a8b9496d95f2d01 100644 (file)
@@ -5684,7 +5684,7 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
 
        tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(objoid));
        if (!HeapTupleIsValid(tuple))
-           elog(ERROR, "cache lookup failed for foreign data wrapper %u",
+           elog(ERROR, "cache lookup failed for foreign server %u",
                 objoid);
 
        aclDatum = SysCacheGetAttr(FOREIGNSERVEROID, tuple,
@@ -5765,7 +5765,7 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
 
        tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(objoid));
        if (!HeapTupleIsValid(tuple))
-           elog(ERROR, "cache lookup failed for function %u", objoid);
+           elog(ERROR, "cache lookup failed for schema %u", objoid);
 
        aclDatum = SysCacheGetAttr(NAMESPACEOID, tuple,
                                   Anum_pg_namespace_nspacl, &isNull);
@@ -5807,7 +5807,7 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
 
        tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(objoid));
        if (!HeapTupleIsValid(tuple))
-           elog(ERROR, "cache lookup failed for function %u", objoid);
+           elog(ERROR, "cache lookup failed for type %u", objoid);
 
        aclDatum = SysCacheGetAttr(TYPEOID, tuple, Anum_pg_type_typacl,
                                   &isNull);