Re: pgsql: Remove dead code - Mailing list pgsql-committers

From Justin Pryzby
Subject Re: pgsql: Remove dead code
Date
Msg-id 20221222153041.GN1153@telsasoft.com
Whole thread Raw
In response to pgsql: Remove dead code  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: pgsql: Remove dead code
List pgsql-committers
On Thu, Dec 22, 2022 at 07:21:50AM +0000, Peter Eisentraut wrote:
> Remove dead code
> 
> The second appearance of NamespaceRelationId in this if-else chain is
> in error and can be removed.

This caused me to notice various wrong-looking elog()s.

diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 35a09ea8dac..444407260be 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -4365,19 +4365,19 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
     /* pg_foreign_server */
     else if (classoid == ForeignServerRelationId)
     {
         Datum        aclDatum;
         bool        isNull;
         HeapTuple    tuple;
 
         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,
                                    Anum_pg_foreign_server_srvacl,
                                    &isNull);
 
         /* Add the record, if any, for the top-level object */
         if (!isNull)
             recordExtensionInitPrivWorker(objoid, classoid, 0,
@@ -4451,19 +4451,19 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
     /* pg_namespace */
     else if (classoid == NamespaceRelationId)
     {
         Datum        aclDatum;
         bool        isNull;
         HeapTuple    tuple;
 
         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);
 
         /* Add the record, if any, for the top-level object */
         if (!isNull)
             recordExtensionInitPrivWorker(objoid, classoid, 0,
                                           DatumGetAclP(aclDatum));
 
@@ -4493,19 +4493,19 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
     /* pg_type */
     else if (classoid == TypeRelationId)
     {
         Datum        aclDatum;
         bool        isNull;
         HeapTuple    tuple;
 
         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);
 
         /* Add the record, if any, for the top-level object */
         if (!isNull)
             recordExtensionInitPrivWorker(objoid, classoid, 0,
                                           DatumGetAclP(aclDatum));
 



pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Remove dead code
Next
From: Tom Lane
Date:
Subject: pgsql: Add some recursion and looping defenses in prepjointree.c.