Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8NX1-0006Bb-A5 for pgsql-committers@arkaria.postgresql.org; Thu, 22 Dec 2022 15:30:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p8NWy-0005PV-7o for pgsql-committers@arkaria.postgresql.org; Thu, 22 Dec 2022 15:30:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8NWx-0005PK-U8 for pgsql-committers@lists.postgresql.org; Thu, 22 Dec 2022 15:30:48 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p8NWv-0005ZC-9R for pgsql-committers@lists.postgresql.org; Thu, 22 Dec 2022 15:30:47 +0000 Received: by mail-io1-xd30.google.com with SMTP id p6so1124019iod.13 for ; Thu, 22 Dec 2022 07:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=z6FqRvYZwLBx8K6bYU25faiFLon1fBlWMWRA3sNCNAM=; b=0F0pGYAFLo2FcPNzE8aJgXrF8JVZ0R3MPjX2DuyrA9I7B6N16HWRmz+emmFc3T0o1y rpwGE0AA6FhtkCAOjIu8pYNlJcN1PyabwLbWed79ew1Y8FexokMk9dsFsImYvUGnJf/g 2vchJXSGaOq2wFXs6cU1bXDUiMXNvvP3sf4Avh8BvRSyvbY0DPeJG+KsmenSlNxAzxeM OpwdMi6x1xmvikp9tVVD0DhKbMsKzoxYQBTfyn4XkpKOpnujVyGPB2HaNTR3Qms3lfuv +xuPRar8T3kiUg6j+Ag4T+LL6YjWixy0BhaGUG16fcXJdG7YLKLe320UVlMxXnSdyaVG LmRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z6FqRvYZwLBx8K6bYU25faiFLon1fBlWMWRA3sNCNAM=; b=dQFE1LgH4j28X3eJP0zEwKaBWHysttL8jKSqKHUlKRNqAx777iR1tC3GfRnaP6xTY+ 0B9/4VXqwWJJZBwLbk6EYh1MSCWSQIhDdo9XfBktJNCq0nowsmcHF3bLqb7I6KEBzmRX oRHt9r/ERoQvHTYlJAUM85Zth9270mLKUHGdwrcyzd+zQ0SJHA4QTSDCdp5/0SlDBT1I JiBZ0ntS1pWCtDqT8Fe1xOCcZiJAkFuqBdC2lrblKU57ZVirbzxu2ZcN50c9xnTewxrT aMcGJ0r37Vg81qGaDyiJwQyYt3Q0bVcjEiVKJl/odnusL/ABcM0wzTfxzNDFrbUKfsBq GYqA== X-Gm-Message-State: AFqh2koiAPkUqnJ2cNt6wG5uWXLuhIA/ONI9GKd8XNouIeU8LWeouMs6 TWxDEdFq2wZBb577oDxObJ+IFXP3vQigSsyO X-Google-Smtp-Source: AMrXdXsp/XntywOSPv1NmPD0GC3fcvzFRHyrT1Ix/6fBuVu46IlnWKEQ2Gh8r9t6FRw0mC1ekLhIrg== X-Received: by 2002:a6b:7d0d:0:b0:6e6:726a:bd80 with SMTP id c13-20020a6b7d0d000000b006e6726abd80mr3697267ioq.6.1671723043522; Thu, 22 Dec 2022 07:30:43 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id x8-20020a0566022c4800b006bc039e3224sm233770iov.17.2022.12.22.07.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 07:30:42 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id BB238800DCC; Thu, 22 Dec 2022 09:30:41 -0600 (CST) Date: Thu, 22 Dec 2022 09:30:41 -0600 From: Justin Pryzby To: Peter Eisentraut Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Remove dead code Message-ID: <20221222153041.GN1153@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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));