Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMuAI-007H0V-7d for pgsql-general@arkaria.postgresql.org; Sun, 15 Dec 2024 19:20:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tMuAF-00GR9y-MR for pgsql-general@arkaria.postgresql.org; Sun, 15 Dec 2024 19:20:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMuAF-00GR9p-As for pgsql-general@lists.postgresql.org; Sun, 15 Dec 2024 19:20:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMuAE-0031EA-As for pgsql-general@postgresql.org; Sun, 15 Dec 2024 19:20:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4BFJKNm31753819; Sun, 15 Dec 2024 14:20:23 -0500 From: Tom Lane To: Isaac Morland cc: Pavel Stehule , Ron Johnson , pgsql-general Subject: Re: Request for new column in pg_namespace In-reply-to: References: <1627466.1734283766@sss.pgh.pa.us> Comments: In-reply-to Isaac Morland message dated "Sun, 15 Dec 2024 12:40:12 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1753817.1734290423.1@sss.pgh.pa.us> Date: Sun, 15 Dec 2024 14:20:23 -0500 Message-ID: <1753818.1734290423@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Isaac Morland writes: > On Sun, 15 Dec 2024 at 12:29, Tom Lane wrote: >> What I'd suggest as an improvement that could be implemented >> immediately is to wrap the checks in a user-defined function >> like "is_system_schema(nspname name)". > Would it make sense to make the parameter be of type regnamespace? Meh ... you could, but what the function really needs is the name. Getting from regnamespace (which is an OID) to the name would incur an extra syscache lookup. Admittedly, if it removes the need for the calling query to join to pg_namespace at all, you'd probably come out about even --- the net effect would be about like a hashjoin to pg_namespace, I think, since the syscache would act like the inner hashtable of a hashjoin. regards, tom lane