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.96) (envelope-from ) id 1wxAMf-002U56-1W for pgsql-docs@arkaria.postgresql.org; Thu, 20 Aug 2026 21:31:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wxAMe-00A9Sk-1d for pgsql-docs@arkaria.postgresql.org; Thu, 20 Aug 2026 21:31:56 +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.96) (envelope-from ) id 1wxAMe-00A9Sb-0u for pgsql-docs@lists.postgresql.org; Thu, 20 Aug 2026 21:31:56 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wxAMb-00000000NPM-3Yan for pgsql-docs@lists.postgresql.org; Thu, 20 Aug 2026 21:31:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2026010100; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=4DjRRhBGV0MyVxIrQhcGC4SnUQv5TcOn/PxISvQio28=; b=sqyH5 /oYR4rmB3ppJUqdNtreBbFSba8zEhlQERDu8JPTWNrO1H8MbMjW03Nr3M7Hrb+d2uRgYgfRoi3P18 9Y1kkEP25H8NZ8i1E2gcv7e3eCc4nHoC5++BhfNlWp/fTtOQyj1fIJz7JJFf2Qd6WSoT/TUb31bTA a5CUFIfGfbQrtt1VS1NO2k5H56O+h/RRj6E1mCUrmXKJcyq8PZLZjmAcyKyPIyIbBmIH35PR/KUYd hm9Z45Ix4XGGQ0COfFbfpE3+X98eANLOHV0iAPIQGQucZNiRnE7Ru8j6HQpRXwBhQyeapc4llT38s gNgat8lAOCv+D0t+WplOFy7NZ/HEw==; Received: from bruce by momjian.us with local (Exim 4.98.2) (envelope-from ) id 1wxAMa-0000000HDuH-3tx8; Thu, 20 Aug 2026 17:31:52 -0400 Date: Thu, 20 Aug 2026 17:31:52 -0400 From: Bruce Momjian To: Tom Lane Cc: Ken Harris , "David G. Johnston" , "pgsql-docs@lists.postgresql.org" Subject: Re: Shadowing type names because I am not smart Message-ID: References: <178536354641.1228.15444395280389125710@wrigleys.postgresql.org> <1815772.1785553121@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1815772.1785553121@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jul 31, 2026 at 10:58:41PM -0400, Tom Lane wrote: > Ken Harris writes: > > My message admittedly wandered a bit, but if I had to narrow it down to one > > point of confusion for me, it'd be: > > > Why does shadowing the name of a built-in type behave differently, for > > different built-in types? > > The short answer here is that some "built-in" types just have names > that are in the pg_type catalog, while others have names that are > recognized by the grammar and translated to pg_type names. For > example, "double precision" is not a type name per the basic rules, > but the SQL standard demands that we recognize it. So the grammar > has a production that translates that to "pg_catalog.float8" --- > not just float8 --- and that means that a user-defined type can't > override the meaning of "double precision" no matter what the > search path is. Another example is that "integer" is the name > called out by the SQL spec for the type that is entered in > pg_type as "int4". So "integer" is translated to "pg_catalog.int4" > and you can't override that, but you could override plain "int4" > depending on search_path. Conversely, some error messages translate > type OIDs back to the SQL-standard names, but I suspect that not all > do; there may be places that just report the pg_type name. Should we prohibit users from creating types that are hard-coded into the grammar? -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.